@@ -7,22 +7,30 @@ properties([
77])
88
99def agentSelector (String imageType ) {
10- // Linux agent
11- if (imageType == ' linux' ) {
12- // This function is defined in the jenkins-infra/pipeline-library
13- if (infra. isTrusted()) {
14- return ' linux'
15- } else {
16- // Need Docker and a LOT of memory for faster builds (due to multi archs) or fallback to linux (trusted.ci)
17- return ' docker-highmem'
18- }
19- }
20- // Windows Server Core 2022 agent
21- if (imageType. contains(' 2022' )) {
22- return ' windows-2022'
10+ def agentTemplateLabel
11+ switch (imageType) {
12+ // Linux
13+ case ~/ linux|alpine*|debian*|rhel*/ :
14+ // Need Docker and a LOT of memory for faster builds (due to multi archs)
15+ agentTemplateLabel = ' docker-highmem'
16+ // Fallback to linux on trusted.ci
17+ if (infra. isTrusted()) {
18+ agentTemplateLabel = ' linux'
19+ }
20+ break
21+
22+ // TODO: to be removed later, see https://github.com/jenkins-infra/helpdesk/issues/4954
23+ // nanoserver 1809, ltsc2019 and windowservercore ltsc2019
24+ case ~/ .*9/ :
25+ agentTemplateLabel = ' windows-2019'
26+ break
27+
28+ // Build on Windows 2025 agent by default
29+ default :
30+ agentTemplateLabel = ' windows-2025'
31+ break
2332 }
24- // Windows Server Core 2019 agent (for nanoserver 1809 & ltsc2019 and for windowservercore ltsc2019)
25- return ' windows-2019'
33+ return agentTemplateLabel
2634}
2735
2836// Ref. https://github.com/jenkins-infra/pipeline-library/pull/917
@@ -93,7 +101,7 @@ def parallelStages = [failFast: false]
93101 }
94102 } else {
95103 // ci.jenkins.io builds (e.g. no publication)
96- stage(' Build' ) {
104+ stage(" Build on a ' ${ resolvedAgentLabel } ' agent " {
97105 if (isUnix()) {
98106 sh ' ./build.sh'
99107 } else {
0 commit comments