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