11# # Variables
2- variable "jdks_to_build" {
2+ variable "jdks_to_build_for_lts" {
3+ default = [17 , 21 , 25 ]
4+ }
5+
6+ variable "jdks_to_build_for_weekly" {
37 default = [17 , 21 , 25 ]
48}
59
@@ -99,7 +103,7 @@ variable "current_rhel" {
99103# # Targets
100104target "alpine" {
101105 matrix = {
102- jdk = jdks_to_build
106+ jdk = jdks_to_build ()
103107 }
104108 name = " alpine_jdk${ jdk } "
105109 dockerfile = " alpine/hotspot/Dockerfile"
@@ -119,7 +123,7 @@ target "alpine" {
119123
120124target "debian" {
121125 matrix = {
122- jdk = jdks_to_build
126+ jdk = jdks_to_build ()
123127 variant = debian_variants
124128 }
125129 name = " ${ variant } _jdk${ jdk } "
@@ -142,7 +146,7 @@ target "debian" {
142146
143147target "rhel" {
144148 matrix = {
145- jdk = jdks_to_build
149+ jdk = jdks_to_build ()
146150 }
147151 name = " rhel_jdk${ jdk } "
148152 dockerfile = " rhel/Dockerfile"
@@ -171,6 +175,21 @@ group "linux" {
171175}
172176
173177# # Common functions
178+ # return true if JENKINS_VERSION is a Weekly (one sequence of digits with a trailing literal '.')
179+ function "is_jenkins_version_weekly" {
180+ # If JENKINS_VERSION has more than one sequence of digits with a trailing literal '.', this is LTS
181+ # 2.523 has only one sequence of digits with a trailing literal '.'
182+ # 2.516.1 has two sequences of digits with a trailing literal '.'
183+ params = []
184+ result = length (regexall (" [0-9]+[.]" , JENKINS_VERSION)) < 2 ? true : false
185+ }
186+
187+ # return the list of jdk to build depending on JENKINS_VERSION
188+ function "jdks_to_build" {
189+ params = []
190+ result = is_jenkins_version_weekly () ? jdks_to_build_for_weekly : jdks_to_build_for_lts
191+ }
192+
174193# return a tag prefixed by the Jenkins version
175194function "_tag_jenkins_version" {
176195 params = [tag ]
@@ -197,13 +216,10 @@ function "tag_lts" {
197216
198217# return WAR_URL if not empty, get.jenkins.io URL depending on JENKINS_VERSION release line otherwise
199218function "war_url" {
200- # If JENKINS_VERSION has more than one sequence of digits with a trailing literal '.', this is LTS
201- # 2.523 has only one sequence of digits with a trailing literal '.'
202- # 2.516.1 has two sequences of digits with a trailing literal '.'
203219 params = []
204220 result = (notequal (WAR_URL, " " )
205221 ? WAR_URL
206- : (length ( regexall ( " [0-9]+[.] " , JENKINS_VERSION)) < 2
222+ : (is_jenkins_version_weekly ()
207223 ? " https://get.jenkins.io/war/${ JENKINS_VERSION } /jenkins.war"
208224 : " https://get.jenkins.io/war-stable/${ JENKINS_VERSION } /jenkins.war" ))
209225}
0 commit comments