mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-12-16 05:19:47 +01:00
Prevent latest docker tag for hotfix releases
Pushed-by: Florian Scholdei<florian.scholdei@cloudogu.com> Co-authored-by: Florian Scholdei<florian.scholdei@cloudogu.com> Committed-by: Florian Scholdei<florian.scholdei@cloudogu.com>
This commit is contained in:
6
Jenkinsfile
vendored
6
Jenkinsfile
vendored
@@ -120,7 +120,7 @@ pipeline {
|
|||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
withPublishEnvironment {
|
withPublishEnvironment {
|
||||||
gradle "-PenablePackaging publish"
|
gradle "-PenablePackaging publish -PisHotfix=${isHotfixBuild()}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -266,6 +266,10 @@ boolean isReleaseBuild() {
|
|||||||
return env.BRANCH_NAME.startsWith('release/')
|
return env.BRANCH_NAME.startsWith('release/')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean isHotfixBuild() {
|
||||||
|
return env.BRANCH_NAME.startsWith('hotfix/')
|
||||||
|
}
|
||||||
|
|
||||||
String getReleaseVersion() {
|
String getReleaseVersion() {
|
||||||
if (isReleaseBuild()) {
|
if (isReleaseBuild()) {
|
||||||
return env.BRANCH_NAME.substring("release/".length());
|
return env.BRANCH_NAME.substring("release/".length());
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ task build(type: Exec) {
|
|||||||
environment "VERSION", dockerTag
|
environment "VERSION", dockerTag
|
||||||
environment "COMMIT_SHA", revision
|
environment "COMMIT_SHA", revision
|
||||||
environment "IMAGE", dockerRepository
|
environment "IMAGE", dockerRepository
|
||||||
|
environment "IS_HOTFIX", isHotfix
|
||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
File file = new File(project.buildDir, 'docker.tag')
|
File file = new File(project.buildDir, 'docker.tag')
|
||||||
@@ -107,6 +108,7 @@ task pushImages(type: Exec) {
|
|||||||
environment "VERSION", dockerTag
|
environment "VERSION", dockerTag
|
||||||
environment "COMMIT_SHA", revision
|
environment "COMMIT_SHA", revision
|
||||||
environment "IMAGE", dockerRepository
|
environment "IMAGE", dockerRepository
|
||||||
|
environment "IS_HOTFIX", isHotfix
|
||||||
|
|
||||||
dependsOn 'build'
|
dependsOn 'build'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,10 @@ variable "IMAGE" {
|
|||||||
default = "docker.io/cloudogu/scm-manager"
|
default = "docker.io/cloudogu/scm-manager"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "IS_HOTFIX" {
|
||||||
|
default = false
|
||||||
|
}
|
||||||
|
|
||||||
target "base" {
|
target "base" {
|
||||||
context = "."
|
context = "."
|
||||||
args = {
|
args = {
|
||||||
@@ -69,7 +73,7 @@ target "alpine" {
|
|||||||
inherits = ["base"]
|
inherits = ["base"]
|
||||||
dockerfile = "Dockerfile.alpine"
|
dockerfile = "Dockerfile.alpine"
|
||||||
tags = [
|
tags = [
|
||||||
"${IMAGE}:latest",
|
IS_HOTFIX ? "" : "${IMAGE}:latest",
|
||||||
"${IMAGE}:${VERSION}",
|
"${IMAGE}:${VERSION}",
|
||||||
"${IMAGE}:${VERSION}-alpine"
|
"${IMAGE}:${VERSION}-alpine"
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user