Jenkinsfile

This commit is contained in:
Juan 2018-05-10 17:50:42 +02:00
parent 40f3c57da9
commit 92a5679ff6
1 changed files with 17 additions and 17 deletions

34
Jenkinsfile vendored
View File

@ -1,30 +1,30 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
def branchName = "${env.BRANCH_NAME}"; def branchName = env.BRANCH_NAME;
// TODO: We are using latest tag until image rotation it's implemented // TODO: We are using latest tag until image rotation it's implemented
env.TAG = "latest" /* "${env.BUILD_NUMBER}" */; env.TAG = 'latest' /* env.BUILD_NUMBER */;
env.BRANCH_NAME = branchName; env.BRANCH_NAME = branchName;
env.salixUser="${env.salixUser}"; env.salixUser = env.salixUser;
env.salixPassword="${env.salixPassword}"; env.salixPassword = env.salixPassword;
switch (branchName) { switch (branchName) {
case "test": case 'test':
env.NODE_ENV = "test"; env.NODE_ENV = 'test';
env.salixHost = "${env.testSalixHost}"; env.salixHost = env.testSalixHost;
env.salixPort = "${env.testSalixPort}"; env.salixPort = env.testSalixPort;
break; break;
case "master": case 'master':
env.NODE_ENV = "production" env.NODE_ENV = 'production'
env.salixHost = "${env.productionSalixHost}"; env.salixHost = env.productionSalixHost;
env.salixPort = "${env.productionSalixPort}"; env.salixPort = env.productionSalixPort;
env.DOCKER_HOST = "tcp://vch1.verdnatura.es:2375"; env.DOCKER_HOST = 'tcp://vch1.verdnatura.es:2375';
break; break;
} }
node { node {
stage ('Print environment variables') { stage ('Print environment variables') {
echo "Branch ${branchName}, Build ${env.TAG}, salixHost ${env.salixHost}, NODE_ENV ${env.NODE_ENV} en docker Host ${env.DOCKER_HOST}" echo "Branch ${branchName}, tag ${env.TAG}, environament ${env.NODE_ENV}"
} }
stage ('Checkout') { stage ('Checkout') {
checkout scm checkout scm
@ -35,13 +35,13 @@ node {
stage ('Build project') { stage ('Build project') {
sh "gulp build" sh "gulp build"
} }
stage ("Install services Node dependencies") { stage ('Install services Node dependencies') {
sh "cd ./services/loopback && npm install" sh "cd ./services/loopback && npm install"
} }
stage ("Removing old dockers") { stage ('Removing old dockers') {
sh "docker-compose down --rmi 'all'" sh "docker-compose down --rmi 'all'"
} }
stage ("Generating new dockers") { stage ('Generating new dockers') {
sh "docker-compose up -d --build" sh "docker-compose up -d --build"
} }
} }