diff --git a/vars/buildContainerImage2.groovy b/vars/buildContainerImage2.groovy index f9db4d9..2061bff 100644 --- a/vars/buildContainerImage2.groovy +++ b/vars/buildContainerImage2.groovy @@ -7,6 +7,7 @@ def call(args) { def tag = args?.tag def archlist = args?.archlist def schedule = args?.schedule + def defaultBranch = args?.defaultBranch properties([ pipelineTriggers([cron(schedule ?: 'H H H * *')]) @@ -27,6 +28,9 @@ def call(args) { if (archlist == null) { archlist = ['amd64'] } + if (defaultBranch == null) { + defaultBranch = 'main' + } def repo = "${registry}/${project}/${name}" def full_name = "${repo}:${tag}" @@ -72,7 +76,7 @@ def call(args) { } sh "buildah push ${full_name} ${full_name}-${env.BUILD_NUMBER}" sh "buildah push ${full_name}" - if (env.BRANCH_NAME == 'main') { + if (env.BRANCH_NAME == defaultBranch) { sh "buildah push ${full_name} ${repo}:latest" } }