Skip to content

Commit f7de2ce

Browse files
committed
try out pipeline lib PoC
1 parent f0d68c0 commit f7de2ce

File tree

1 file changed

+22
-31
lines changed

1 file changed

+22
-31
lines changed

Jenkinsfile

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@Library('pipeline-library@pull/980/head') _
2+
13
final String cronExpr = env.BRANCH_IS_PRIMARY ? '@daily' : ''
24

35
properties([
@@ -9,47 +11,36 @@ properties([
911
def agentSelector(String imageType, spotRetryCounter) {
1012
def platform
1113
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-
platform = 'docker-highmem'
16-
// Fallback to 'linux' on trusted.ci
17-
if (infra.isTrusted()) {
18-
platform = 'linux'
19-
}
20-
break
21-
22-
// TODO: to be removed later cf https://github.com/jenkins-infra/helpdesk/issues/4954
23-
// nanoserver 1809, ltsc2019 and windowservercore ltsc2019
14+
// TODO: to be removed later, when Windows 2019 support is dropped
15+
// cf https://github.com/jenkins-infra/helpdesk/issues/4954
16+
// nanoserver-1809, nanoserver-ltsc2019 and windowservercore-ltsc2019
2417
case ~/.*9/:
2518
platform = 'windows-2019'
2619
break
2720

28-
// TODO: to be removed later cf https://github.com/jenkins-infra/helpdesk/issues/4956
29-
// nanoserver ltsc2022 and windowservercore ltsc2022
21+
// TODO: to be removed later, when using Windows 2025 agents by default
22+
// cf https://github.com/jenkins-infra/helpdesk/issues/4956
23+
// nanoserver-ltsc2022 and windowservercore-ltsc2022
3024
case ~/.*2/:
3125
platform = 'windows-2022'
3226
break
3327

34-
// Build on Windows 2025 agent by default
35-
default:
28+
// TODO: to be replaced by ~/*server*/, when using Windows 2025 agents by default for Windows images
29+
// cf https://github.com/jenkins-infra/helpdesk/issues/4956
30+
// nanoserver-ltsc2025 and windowservercore-ltsc2025
31+
case ~/.*5/:
3632
platform = 'windows-2025'
3733
break
38-
}
3934

40-
// Defined in https://github.com/jenkins-infra/pipeline-library/blob/master/vars/infra.groovy
41-
def agentLabel = infra.getBuildAgentLabel(platform, 'any', false)
42-
43-
// Spot/Non-spot
44-
if (infra.isTrusted()) {
45-
return agentLabel
46-
}
47-
48-
if (spotRetryCounter > 1) {
49-
return agentLabel + ' && nonspot'
35+
// Linux
36+
default:
37+
// Need Docker and a LOT of memory for faster builds (due to multi archs)
38+
platform = 'docker-highmem'
39+
break
5040
}
5141

52-
return agentLabel + ' && spot'
42+
// Defined in https://github.com/jenkins-infra/pipeline-library/blob/master/vars/infra.groovy
43+
return infra.getBuildAgentLabel(platform, 'any', false, spotRetryCounter)
5344
}
5445

5546
// Specify parallel stages
@@ -65,11 +56,11 @@ def parallelStages = [failFast: false]
6556
].each { imageType ->
6657
parallelStages[imageType] = {
6758
withEnv(["IMAGE_TYPE=${imageType}", "REGISTRY_ORG=${infra.isTrusted() ? 'jenkins' : 'jenkins4eval'}"]) {
68-
int spotRetryCounter = 0
59+
int retryCounter = 0
6960
retry(count: 2, conditions: [agent(), nonresumable()]) {
7061
// Use local variable to manage concurrency and increment BEFORE spinning up any agent
71-
final String resolvedAgentLabel = agentSelector(imageType, spotRetryCounter)
72-
spotRetryCounter++
62+
final String resolvedAgentLabel = agentSelector(imageType, retryCounter)
63+
retryCounter++
7364
node(resolvedAgentLabel) {
7465
timeout(time: 60, unit: 'MINUTES') {
7566
checkout scm

0 commit comments

Comments
 (0)