refs #4685 Jenkinsfile variable fix
gitea/mycdc/pipeline/head This commit looks good Details

This commit is contained in:
Juan Ferrer 2025-02-26 17:13:39 +01:00
parent a1bdcf4fae
commit 25aec35f0c
1 changed files with 2 additions and 3 deletions

5
Jenkinsfile vendored
View File

@ -1,7 +1,6 @@
#!/usr/bin/env groovy
def PROTECTED_BRANCH
def IS_LATEST
node {
stage('Setup') {
@ -13,7 +12,6 @@ node {
'beta'
].contains(env.BRANCH_NAME)
IS_LATEST = ['master', 'main'].contains(env.BRANCH_NAME)
// https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables
echo "NODE_NAME: ${env.NODE_NAME}"
@ -96,9 +94,10 @@ def dockerBuild(imageName, context, dockerfile = null) {
}
def dockerPush(image) {
def isLatest = ['master', 'main'].contains(env.BRANCH_NAME)
docker.withRegistry("https://${env.REGISTRY}", 'docker-registry') {
image.push()
image.push(env.BRANCH_NAME)
if (IS_LATEST) image.push('latest')
if (isLatest) image.push('latest')
}
}