fix: refs #6706 Jenkinsfile fixes
gitea/salix/pipeline/head This commit looks good Details
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Juan Ferrer 2024-02-02 14:27:36 +01:00
parent 42bf3db629
commit 1d0fd0ad4f
1 changed files with 14 additions and 13 deletions

27
Jenkinsfile vendored
View File

@ -32,19 +32,6 @@ pre: {
// https://loopback.io/doc/en/lb3/Setting-debug-strings.html#debug-strings-reference // https://loopback.io/doc/en/lb3/Setting-debug-strings.html#debug-strings-reference
//env.DEBUG = 'strong-remoting:shared-method' //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 { pipeline {
agent any agent any
options { options {
@ -115,6 +102,10 @@ pipeline {
CREDENTIALS = credentials('docker-registry') CREDENTIALS = credentials('docker-registry')
} }
steps { steps {
script {
def packageJson = readJSON file: 'package.json'
env.VERSION = packageJson.version
}
sh 'gulp build' sh 'gulp build'
dockerBuild() dockerBuild()
} }
@ -145,6 +136,10 @@ pipeline {
DOCKER_HOST = "${env.SWARM_HOST}" DOCKER_HOST = "${env.SWARM_HOST}"
} }
steps { 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}" sh "docker stack deploy --with-registry-auth --compose-file docker-compose.yml ${env.STACK_NAME}"
} }
} }
@ -167,6 +162,11 @@ pipeline {
success { success {
script { script {
if (env.BRANCH_NAME == 'master' && FROM_GIT) { 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 String message = env.GIT_COMMIT_MSG
int index = message.indexOf('\n') int index = message.indexOf('\n')
if (index != -1) if (index != -1)
@ -183,6 +183,7 @@ pipeline {
} }
} }
unsuccessful { unsuccessful {
setEnv()
sendEmail() sendEmail()
} }
} }