Jenkinsfile fixes

This commit is contained in:
Juan Ferrer 2019-01-11 14:06:13 +01:00
parent eb3aa84fc5
commit 1e63adbdca
1 changed files with 33 additions and 24 deletions

57
Jenkinsfile vendored
View File

@ -35,6 +35,7 @@ pipeline {
break;
}
}
checkout scm
script {
env.GIT_COMMITTER_EMAIL = sh(
@ -49,45 +50,53 @@ pipeline {
environment {
NODE_ENV = ''
}
nodejs('node-lts') {
sh "npm install --no-audit"
sh "gulp install"
steps {
nodejs('node-lts') {
sh "npm install --no-audit"
sh "gulp install"
}
}
}
stage ('Build') {
environment {
CREDS = credentials('docker-registry')
}
nodejs('node-lts') {
sh "gulp build"
steps {
nodejs('node-lts') {
sh "gulp build"
}
sh 'docker login --username $CREDS_USR --password $CREDS_PSW $REGISTRY'
sh "docker-compose build --parallel"
sh "docker-compose push"
}
sh 'docker login --username $CREDS_USR --password $CREDS_PSW $REGISTRY'
sh "docker-compose build --parallel"
sh "docker-compose push"
}
stage ('Deploy') {
environment {
DOCKER_TLS_VERIFY = 1
}
parallel(
vch1: {
environment {
DOCKER_HOST = "${env.DOCKER_HOST_1}"
steps {
parallel(
vch1: {
environment {
DOCKER_HOST = "${env.DOCKER_HOST_1}"
}
sh "docker-compose pull"
sh "docker-compose up -d"
},
vch2: {
environment {
DOCKER_HOST = "${env.DOCKER_HOST_2}"
}
sh "docker-compose pull"
sh "docker-compose up -d"
}
sh "docker-compose pull"
sh "docker-compose up -d"
},
vch2: {
environment {
DOCKER_HOST = "${env.DOCKER_HOST_2}"
}
sh "docker-compose pull"
sh "docker-compose up -d"
}
)
)
}
}
stage ('Cleanup') {
sh 'docker logout $REGISTRY'
steps {
sh 'docker logout $REGISTRY'
}
}
}
post {