fix: refs #8285 Fix pipeline version
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Juan Ferrer 2024-12-10 11:13:38 +01:00
parent dfbe1ef556
commit 15d3f7ee60
1 changed files with 10 additions and 18 deletions

28
Jenkinsfile vendored
View File

@ -102,8 +102,6 @@ pipeline {
def packageJson = readJSON file: 'package.json' def packageJson = readJSON file: 'package.json'
def version = "${packageJson.version}-build${env.BUILD_ID}" def version = "${packageJson.version}-build${env.BUILD_ID}"
writeFile(file: 'VERSION.txt', text: version) writeFile(file: 'VERSION.txt', text: version)
def readVersion = readFile(file: 'VERSION.txt').trim()
echo "VERSION: ${readVersion}"
} }
} }
} }
@ -134,11 +132,10 @@ pipeline {
when { when {
expression { RUN_BUILD } expression { RUN_BUILD }
} }
steps { environment {
script { VERSION = readFile 'VERSION.txt'
def packageJson = readJSON file: 'package.json'
env.VERSION = "${packageJson.version}-build${env.BUILD_ID}"
} }
steps {
sh 'docker-compose build back' sh 'docker-compose build back'
} }
} }
@ -172,11 +169,10 @@ pipeline {
when { when {
expression { RUN_BUILD } expression { RUN_BUILD }
} }
steps { environment {
script { VERSION = readFile 'VERSION.txt'
def packageJson = readJSON file: 'package.json'
env.VERSION = "${packageJson.version}-build${env.BUILD_ID}"
} }
steps {
sh 'gulp build' sh 'gulp build'
sh 'docker-compose build front' sh 'docker-compose build front'
} }
@ -191,12 +187,9 @@ pipeline {
} }
environment { environment {
CREDENTIALS = credentials('docker-registry') CREDENTIALS = credentials('docker-registry')
VERSION = readFile 'VERSION.txt'
} }
steps { 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 login --username $CREDENTIALS_USR --password $CREDENTIALS_PSW $REGISTRY'
sh 'docker-compose push' sh 'docker-compose push'
} }
@ -223,11 +216,10 @@ pipeline {
when { when {
expression { FROM_GIT } expression { FROM_GIT }
} }
steps { environment {
script { VERSION = readFile 'VERSION.txt'
def packageJson = readJSON file: 'package.json'
env.VERSION = "${packageJson.version}-build${env.BUILD_ID}"
} }
steps {
withKubeConfig([ withKubeConfig([
serverUrl: "$KUBERNETES_API", serverUrl: "$KUBERNETES_API",
credentialsId: 'kubernetes', credentialsId: 'kubernetes',