From dfbe1ef5560b15ab297a390d2f6f855bb465e790 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 10 Dec 2024 11:05:57 +0100 Subject: [PATCH 1/3] fix: refs #8285 Fix pipeline version --- Jenkinsfile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 055cf858f..322a715e7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -93,6 +93,20 @@ pipeline { } } } + stage('Version') { + when { + expression { RUN_BUILD } + } + steps { + script { + def packageJson = readJSON file: 'package.json' + def version = "${packageJson.version}-build${env.BUILD_ID}" + writeFile(file: 'VERSION.txt', text: version) + def readVersion = readFile(file: 'VERSION.txt').trim() + echo "VERSION: ${readVersion}" + } + } + } stage('Stack') { parallel { stage('Back') { From 15d3f7ee60d34d5273af57ec1045ea75b7adfe85 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 10 Dec 2024 11:13:38 +0100 Subject: [PATCH 2/3] fix: refs #8285 Fix pipeline version --- Jenkinsfile | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 322a715e7..5422173f1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -102,8 +102,6 @@ pipeline { def packageJson = readJSON file: 'package.json' def version = "${packageJson.version}-build${env.BUILD_ID}" writeFile(file: 'VERSION.txt', text: version) - def readVersion = readFile(file: 'VERSION.txt').trim() - echo "VERSION: ${readVersion}" } } } @@ -134,11 +132,10 @@ pipeline { when { expression { RUN_BUILD } } + environment { + VERSION = readFile 'VERSION.txt' + } steps { - script { - def packageJson = readJSON file: 'package.json' - env.VERSION = "${packageJson.version}-build${env.BUILD_ID}" - } sh 'docker-compose build back' } } @@ -172,11 +169,10 @@ pipeline { when { expression { RUN_BUILD } } + environment { + VERSION = readFile 'VERSION.txt' + } steps { - script { - def packageJson = readJSON file: 'package.json' - env.VERSION = "${packageJson.version}-build${env.BUILD_ID}" - } sh 'gulp build' sh 'docker-compose build front' } @@ -191,12 +187,9 @@ pipeline { } environment { CREDENTIALS = credentials('docker-registry') + VERSION = readFile 'VERSION.txt' } steps { - script { - def packageJson = readJSON file: 'package.json' - env.VERSION = "${packageJson.version}-build${env.BUILD_ID}" - } sh 'docker login --username $CREDENTIALS_USR --password $CREDENTIALS_PSW $REGISTRY' sh 'docker-compose push' } @@ -223,11 +216,10 @@ pipeline { when { expression { FROM_GIT } } + environment { + VERSION = readFile 'VERSION.txt' + } steps { - script { - def packageJson = readJSON file: 'package.json' - env.VERSION = "${packageJson.version}-build${env.BUILD_ID}" - } withKubeConfig([ serverUrl: "$KUBERNETES_API", credentialsId: 'kubernetes', From 9e01313facce715326ff90227f6845f5a6ac8432 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 10 Dec 2024 11:18:21 +0100 Subject: [PATCH 3/3] ci(Jenkinsfile): refs #8285 Move version step to begining --- Jenkinsfile | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5422173f1..06addc940 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -64,6 +64,18 @@ pipeline { PROJECT_NAME = 'salix' } stages { + stage('Version') { + when { + expression { RUN_BUILD } + } + steps { + script { + def packageJson = readJSON file: 'package.json' + def version = "${packageJson.version}-build${env.BUILD_ID}" + writeFile(file: 'VERSION.txt', text: version) + } + } + } stage('Install') { environment { NODE_ENV = '' @@ -93,18 +105,6 @@ pipeline { } } } - stage('Version') { - when { - expression { RUN_BUILD } - } - steps { - script { - def packageJson = readJSON file: 'package.json' - def version = "${packageJson.version}-build${env.BUILD_ID}" - writeFile(file: 'VERSION.txt', text: version) - } - } - } stage('Stack') { parallel { stage('Back') {