Jenkinsfile fixes

This commit is contained in:
Juan Ferrer 2019-01-11 14:15:34 +01:00
parent 1e63adbdca
commit 1b2e5e491c
1 changed files with 22 additions and 19 deletions

23
Jenkinsfile vendored
View File

@ -3,6 +3,7 @@
def buildError
pipeline {
agent any
environment {
REGISTRY = 'registry.verdnatura.es'
DOCKER_HOST_1 = 'tcp://vch1.verdnatura.es:2376'
@ -10,7 +11,7 @@ pipeline {
TAG = "${env.BRANCH_NAME}"
}
stages {
stage ('Checkout') {
stage('Checkout') {
steps {
script {
env.COMPOSE_PROJECT_NAME = env.JOB_NAME.replace('/', '-');
@ -46,7 +47,7 @@ pipeline {
echo "Committer: ${env.GIT_COMMITTER_EMAIL}"
}
}
stage ('Install') {
stage('Install') {
environment {
NODE_ENV = ''
}
@ -57,7 +58,7 @@ pipeline {
}
}
}
stage ('Build') {
stage('Build') {
environment {
CREDS = credentials('docker-registry')
}
@ -70,30 +71,32 @@ pipeline {
sh "docker-compose push"
}
}
stage ('Deploy') {
stage('Deploy') {
environment {
DOCKER_TLS_VERIFY = 1
}
steps {
parallel(
vch1: {
parallel {
stage('Host 1') {
environment {
DOCKER_HOST = "${env.DOCKER_HOST_1}"
}
steps {
sh "docker-compose pull"
sh "docker-compose up -d"
}
},
vch2: {
stage('Host 2') {
environment {
DOCKER_HOST = "${env.DOCKER_HOST_2}"
}
steps {
sh "docker-compose pull"
sh "docker-compose up -d"
}
)
}
}
stage ('Cleanup') {
}
stage('Cleanup') {
steps {
sh 'docker logout $REGISTRY'
}