Skip to content

Commit e7a01e7

Browse files
committed
chore(bake): remove Weekly/LTS differenciations (jenkinsci#2228)
1 parent 23c7978 commit e7a01e7

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

docker-bake.hcl

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,15 @@ group "all" {
215215
}
216216

217217
## Common functions
218+
# return true if JENKINS_VERSION is a Weekly (one sequence of digits with a trailing literal '.')
219+
function "is_jenkins_version_weekly" {
220+
# If JENKINS_VERSION has more than one sequence of digits with a trailing literal '.', this is LTS
221+
# 2.523 has only one sequence of digits with a trailing literal '.'
222+
# 2.516.1 has two sequences of digits with a trailing literal '.'
223+
params = []
224+
result = length(regexall("[0-9]+[.]", JENKINS_VERSION)) < 2 ? true : false
225+
}
226+
218227
# return a tag prefixed by the Jenkins version
219228
function "_tag_jenkins_version" {
220229
params = [tag]
@@ -241,13 +250,10 @@ function "tag_lts" {
241250

242251
# return WAR_URL if not empty, get.jenkins.io URL depending on JENKINS_VERSION release line otherwise
243252
function "war_url" {
244-
# If JENKINS_VERSION has more than one sequence of digits with a trailing literal '.', this is LTS
245-
# 2.523 has only one sequence of digits with a trailing literal '.'
246-
# 2.516.1 has two sequences of digits with a trailing literal '.'
247253
params = []
248254
result = (notequal(WAR_URL, "")
249255
? WAR_URL
250-
: (length(regexall("[0-9]+[.]", JENKINS_VERSION)) < 2
256+
: (is_jenkins_version_weekly()
251257
? "https://get.jenkins.io/war/${JENKINS_VERSION}/jenkins.war"
252258
: "https://get.jenkins.io/war-stable/${JENKINS_VERSION}/jenkins.war"))
253259
}
@@ -400,11 +406,9 @@ function "debian_tags" {
400406
}
401407

402408
# Return array of Windows version(s) to build
403-
# Can be overriden by setting WINDOWS_VERSION_OVERRIDE to a specific Windows version
409+
# Can be overridden by setting WINDOWS_VERSION_OVERRIDE to a specific Windows version
404410
# Ex: WINDOWS_VERSION_OVERRIDE=ltsc2025 docker buildx bake windows
405411
function "windowsversions" {
406412
params = []
407-
result = (notequal(WINDOWS_VERSION_OVERRIDE, "")
408-
? [WINDOWS_VERSION_OVERRIDE]
409-
: windows_version_to_build)
413+
result = notequal(WINDOWS_VERSION_OVERRIDE, "") ? [WINDOWS_VERSION_OVERRIDE] : windows_version_to_build
410414
}

0 commit comments

Comments
 (0)