mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-10-26 08:06:09 +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 {
|
||||
withPublishEnvironment {
|
||||
gradle "-PenablePackaging publish"
|
||||
gradle "-PenablePackaging publish -PisHotfix=${isHotfixBuild()}"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -266,6 +266,10 @@ boolean isReleaseBuild() {
|
||||
return env.BRANCH_NAME.startsWith('release/')
|
||||
}
|
||||
|
||||
boolean isHotfixBuild() {
|
||||
return env.BRANCH_NAME.startsWith('hotfix/')
|
||||
}
|
||||
|
||||
String getReleaseVersion() {
|
||||
if (isReleaseBuild()) {
|
||||
return env.BRANCH_NAME.substring("release/".length());
|
||||
|
||||
@@ -94,6 +94,7 @@ task build(type: Exec) {
|
||||
environment "VERSION", dockerTag
|
||||
environment "COMMIT_SHA", revision
|
||||
environment "IMAGE", dockerRepository
|
||||
environment "IS_HOTFIX", isHotfix
|
||||
|
||||
doLast {
|
||||
File file = new File(project.buildDir, 'docker.tag')
|
||||
@@ -107,6 +108,7 @@ task pushImages(type: Exec) {
|
||||
environment "VERSION", dockerTag
|
||||
environment "COMMIT_SHA", revision
|
||||
environment "IMAGE", dockerRepository
|
||||
environment "IS_HOTFIX", isHotfix
|
||||
|
||||
dependsOn 'build'
|
||||
}
|
||||
|
||||
@@ -41,6 +41,10 @@ variable "IMAGE" {
|
||||
default = "docker.io/cloudogu/scm-manager"
|
||||
}
|
||||
|
||||
variable "IS_HOTFIX" {
|
||||
default = false
|
||||
}
|
||||
|
||||
target "base" {
|
||||
context = "."
|
||||
args = {
|
||||
@@ -69,7 +73,7 @@ target "alpine" {
|
||||
inherits = ["base"]
|
||||
dockerfile = "Dockerfile.alpine"
|
||||
tags = [
|
||||
"${IMAGE}:latest",
|
||||
IS_HOTFIX ? "" : "${IMAGE}:latest",
|
||||
"${IMAGE}:${VERSION}",
|
||||
"${IMAGE}:${VERSION}-alpine"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user