From 1a64126655dcff9cdd1185b089fe59cac7f3356f Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 30 Jan 2024 19:51:30 +0100 Subject: [PATCH] build: refs #5483 Jenkinsfile parallel deploy --- Jenkinsfile | 64 ++++++++++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 11fcbb752..8767a1150 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -97,36 +97,40 @@ pipeline { } } stage('Deploy') { - when { - environment name: 'RUN_SOURCE', value: 'git' - anyOf { - branch 'test' - branch 'master' + parallel { + stage('Docker') { + when { + environment name: 'RUN_SOURCE', value: 'git' + anyOf { + branch 'test' + branch 'master' + } + } + environment { + DOCKER_HOST = "${env.SWARM_HOST}" + } + steps { + sh "docker stack deploy --with-registry-auth --compose-file docker-compose.yml ${env.STACK_NAME}" + } } - } - environment { - DOCKER_HOST = "${env.SWARM_HOST}" - } - steps { - sh "docker stack deploy --with-registry-auth --compose-file docker-compose.yml ${env.STACK_NAME}" - } - } - stage('Database') { - when { anyOf { - branch 'dev' - branch 'test' - branch 'master' - }} - steps { - configFileProvider([ - configFile(fileId: "config.${env.NODE_ENV}.ini", - variable: 'MYSQL_CONFIG') - ]) { - sh 'mkdir -p db/remotes' - sh 'cp "$MYSQL_CONFIG" db/remotes/$NODE_ENV.ini' - } - nodejs('node-v20') { - sh 'npx myt push $NODE_ENV --force --commit' + stage('Database') { + when { anyOf { + branch 'dev' + branch 'test' + branch 'master' + }} + steps { + configFileProvider([ + configFile(fileId: "config.${env.NODE_ENV}.ini", + variable: 'MYSQL_CONFIG') + ]) { + sh 'mkdir -p db/remotes' + sh 'cp "$MYSQL_CONFIG" db/remotes/$NODE_ENV.ini' + } + nodejs('node-v20') { + sh 'npx myt push $NODE_ENV --force --commit' + } + } } } } @@ -135,7 +139,7 @@ pipeline { success { script { if (env.RUN_SOURCE == 'git' - && ['master', 'test', 'dev'].contains(env.BRANCH_NAME)) { + && ['master', 'test'].contains(env.BRANCH_NAME)) { String message = env.GIT_COMMIT_MSG int index = message.indexOf('\n') if (index != -1)