From 1d0fd0ad4fae0c9777e99118a2c98b9d4200f77e Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 2 Feb 2024 14:27:36 +0100 Subject: [PATCH] fix: refs #6706 Jenkinsfile fixes --- Jenkinsfile | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4914f8f1c..5d2ae55a5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -32,19 +32,6 @@ pre: { // https://loopback.io/doc/en/lb3/Setting-debug-strings.html#debug-strings-reference //env.DEBUG = 'strong-remoting:shared-method' } -node { - stage('Setup') { - def packageJson = readJSON file: 'package.json' - env.VERSION = packageJson.version - - env.GIT_COMMIT_MSG = sh( - script: 'git log -1 --pretty=%B ${GIT_COMMIT}', - returnStdout: true - ).trim() - - setEnv() - } -} pipeline { agent any options { @@ -115,6 +102,10 @@ pipeline { CREDENTIALS = credentials('docker-registry') } steps { + script { + def packageJson = readJSON file: 'package.json' + env.VERSION = packageJson.version + } sh 'gulp build' dockerBuild() } @@ -145,6 +136,10 @@ pipeline { DOCKER_HOST = "${env.SWARM_HOST}" } steps { + script { + def packageJson = readJSON file: 'package.json' + env.VERSION = packageJson.version + } sh "docker stack deploy --with-registry-auth --compose-file docker-compose.yml ${env.STACK_NAME}" } } @@ -167,6 +162,11 @@ pipeline { success { script { if (env.BRANCH_NAME == 'master' && FROM_GIT) { + env.GIT_COMMIT_MSG = sh( + script: 'git log -1 --pretty=%B ${GIT_COMMIT}', + returnStdout: true + ).trim() + String message = env.GIT_COMMIT_MSG int index = message.indexOf('\n') if (index != -1) @@ -183,6 +183,7 @@ pipeline { } } unsuccessful { + setEnv() sendEmail() } }