From 1b2e5e491c41c5cb20c8f0ff7a58c47d08dafbd8 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 11 Jan 2019 14:15:34 +0100 Subject: [PATCH] Jenkinsfile fixes --- Jenkinsfile | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b37866d65..3ad377aa1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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: { - environment { - DOCKER_HOST = "${env.DOCKER_HOST_1}" - } - sh "docker-compose pull" - sh "docker-compose up -d" - }, - vch2: { - environment { - DOCKER_HOST = "${env.DOCKER_HOST_2}" - } + parallel { + stage('Host 1') { + environment { + DOCKER_HOST = "${env.DOCKER_HOST_1}" + } + steps { sh "docker-compose pull" sh "docker-compose up -d" } - ) + }, + 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' }