Jenkins
This commit is contained in:
parent
2d05b61c8d
commit
12d34668a9
|
@ -152,7 +152,12 @@ gulp.task('docker-compose', async () => {
|
|||
// dockerFile = 'Dockerfile';
|
||||
|
||||
composeYml.services[service.name] = {
|
||||
environment: ['NODE_ENV=${NODE_ENV}'],
|
||||
environment: ['NODE_ENV=${NODE_ENV}',
|
||||
'salixHost=${salixHost}',
|
||||
'salixUser=${salixUser}',
|
||||
'salixPassword=${salixPassword}',
|
||||
'salixPort=${salixPort}'
|
||||
],
|
||||
container_name: `\${BRANCH_NAME}-${service.name}`,
|
||||
image: `${service.name}:\${TAG}`,
|
||||
build: {
|
||||
|
@ -459,7 +464,6 @@ gulp.task('docker-wait', callback => {
|
|||
let elapsedTime = 0;
|
||||
let maxInterval = 30 * 60;
|
||||
|
||||
console.log('process', process.env.salixPassword);
|
||||
log('Waiting for MySQL init process...');
|
||||
checker();
|
||||
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"salixHost": "localhost",
|
||||
"salixPort": 3306,
|
||||
"salixUser": "root",
|
||||
"salixPassword": ""
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
#!/usr/bin/env groovy
|
||||
|
||||
def branchName = "${env.BRANCH_NAME}";
|
||||
def branchProduction = "master"
|
||||
def branchTest = "test";
|
||||
|
||||
env.BRANCH_NAME = branchName;
|
||||
env.TAG = "${env.BUILD_NUMBER}";
|
||||
env.salixUser="${env.salixUser}";
|
||||
env.salixPassword="${env.salixPassword}";
|
||||
env.salixHost = "${env.productionSalixHost}";
|
||||
env.salixPort = "${env.productionSalixPort}";
|
||||
|
||||
switch (branchName){
|
||||
case branchTest:
|
||||
env.NODE_ENV = "test";
|
||||
env.salixHost = "${env.testSalixHost}";
|
||||
env.salixPort = "${env.testSalixPort}";
|
||||
break;
|
||||
case branchProduction:
|
||||
env.DOCKER_HOST = "tcp://172.16.255.29:2375";
|
||||
env.NODE_ENV = "production"
|
||||
break;
|
||||
}
|
||||
|
||||
node
|
||||
{
|
||||
stage ('Print environment variables'){
|
||||
echo "Branch ${branchName}, Build ${env.TAG}, salixHost ${env.salixHost}, NODE_ENV ${env.NODE_ENV} en docker Host ${env.DOCKER_HOST}"
|
||||
}
|
||||
stage ('Checkout') {
|
||||
checkout scm
|
||||
}
|
||||
|
||||
stage ('install modules'){
|
||||
sh "npm install"
|
||||
}
|
||||
|
||||
stage ('build Project'){
|
||||
sh "gulp build"
|
||||
}
|
||||
|
||||
stage ("docker")
|
||||
{
|
||||
stage ("install modules loopback service")
|
||||
{
|
||||
sh "cd ./services/loopback && npm install"
|
||||
}
|
||||
|
||||
stage ("Stopping/Removing Docker")
|
||||
{
|
||||
sh "docker-compose down --rmi 'all'"
|
||||
}
|
||||
|
||||
stage ("Generar dockers")
|
||||
{
|
||||
sh "docker-compose up -d --build"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue