Fix distribution call when calling without setting hotfix variable

This commit is contained in:
Laura Gorzitze
2024-06-18 10:52:14 +02:00
parent 25548e9f0a
commit 978aebf664

View File

@@ -91,10 +91,8 @@ task setupBuilder() {
task build(type: Exec) {
commandLine = ["docker", "buildx", "bake", "--builder", "scm-builder", isSnapshot ? "dev": "prod"]
environment "VERSION", dockerTag
environment "COMMIT_SHA", revision
environment "IMAGE", dockerRepository
environment "IS_HOTFIX", isHotfix
setEnvironmentForDockerBuild({ String name, Object value -> environment(name, value) })
doLast {
File file = new File(project.buildDir, 'docker.tag')
@@ -105,10 +103,8 @@ task build(type: Exec) {
task pushImages(type: Exec) {
commandLine = ["docker", "buildx", "bake", "--builder", "scm-builder", isSnapshot ? "dev": "prod", "--push"]
environment "VERSION", dockerTag
environment "COMMIT_SHA", revision
environment "IMAGE", dockerRepository
environment "IS_HOTFIX", isHotfix
setEnvironmentForDockerBuild({ String name, Object value -> environment(name, value) })
dependsOn 'build'
}
@@ -145,3 +141,17 @@ license {
task check {
dependsOn checkLicenses
}
def setEnvironmentForDockerBuild(environment){
environment "VERSION", dockerTag
environment "COMMIT_SHA", revision
environment "IMAGE", dockerRepository
if (project.hasProperty("isHotfix")) {
environment "IS_HOTFIX", isHotfix
println("Setting hotfix to ${isHotfix}")
} else {
environment "IS_HOTFIX", true
println("'isHotfix'-Property not defined. Assuming hotfix release")
}
}