Skip to content

Commit 45e833e

Browse files
committed
Define stages an go back to 2 forks as 3 is not more efficient
1 parent 0e0e873 commit 45e833e

File tree

1 file changed

+38
-33
lines changed

1 file changed

+38
-33
lines changed

Jenkinsfile

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,48 +5,53 @@ properties([
55
])
66

77
def splits
8-
node('linux') {
9-
checkout scm
10-
splits = splitTests parallelism: count(3), generateInclusions: true, estimateTestsFromFiles: true
8+
stage('Determine splits') {
9+
node('linux') {
10+
checkout scm
11+
splits = splitTests parallelism: count(2), generateInclusions: true, estimateTestsFromFiles: true
12+
}
1113
}
12-
def branches = [:]
13-
branches['failFast'] = true
14+
stage('Tests') {
15+
def branches = [:]
16+
branches['failFast'] = true
1417

15-
for (int i = 0; i < splits.size(); i++) {
16-
def num = i
17-
def split = splits[num]
18-
def index = num + 1
19-
branches["kind-${index}"] = {
20-
node('docker') {
21-
timeout(90) {
22-
checkout scm
23-
try {
24-
writeFile file: (split.includes ? "$WORKSPACE_TMP/includes.txt" : "$WORKSPACE_TMP/excludes.txt"), text: split.list.join("\n")
25-
writeFile file: (split.includes ? "$WORKSPACE_TMP/excludes.txt" : "$WORKSPACE_TMP/includes.txt"), text: ''
26-
sh './kind.sh -Dsurefire.includesFile="$WORKSPACE_TMP/includes.txt" -Dsurefire.excludesFile="$WORKSPACE_TMP/excludes.txt"'
27-
dir (env.WORKSPACE_TMP) {
28-
junit 'surefire-reports/*.xml'
29-
}
30-
} finally {
31-
dir (env.WORKSPACE_TMP) {
32-
if (fileExists('kindlogs/docker-info.txt')) {
33-
archiveArtifacts 'kindlogs/'
18+
for (int i = 0; i < splits.size(); i++) {
19+
def num = i
20+
def split = splits[num]
21+
def index = num + 1
22+
branches["kind-${index}"] = {
23+
node('docker') {
24+
timeout(90) {
25+
checkout scm
26+
try {
27+
writeFile file: (split.includes ? "$WORKSPACE_TMP/includes.txt" : "$WORKSPACE_TMP/excludes.txt"), text: split.list.join("\n")
28+
writeFile file: (split.includes ? "$WORKSPACE_TMP/excludes.txt" : "$WORKSPACE_TMP/includes.txt"), text: ''
29+
sh './kind.sh -Dsurefire.includesFile="$WORKSPACE_TMP/includes.txt" -Dsurefire.excludesFile="$WORKSPACE_TMP/excludes.txt"'
30+
dir(env.WORKSPACE_TMP) {
31+
junit 'surefire-reports/*.xml'
32+
}
33+
} finally {
34+
dir(env.WORKSPACE_TMP) {
35+
if (fileExists('kindlogs/docker-info.txt')) {
36+
archiveArtifacts 'kindlogs/'
37+
}
3438
}
3539
}
3640
}
3741
}
3842
}
3943
}
40-
}
41-
branches['jdk11'] = {
42-
node('maven-11') {
43-
timeout(60) {
44-
checkout scm
45-
sh 'mvn -B -ntp -Dset.changelist -Dmaven.test.failure.ignore clean install'
46-
infra.prepareToPublishIncrementals()
47-
junit 'target/surefire-reports/*.xml'
44+
branches['jdk11'] = {
45+
node('maven-11') {
46+
timeout(60) {
47+
checkout scm
48+
sh 'mvn -B -ntp -Dset.changelist -Dmaven.test.failure.ignore clean install'
49+
infra.prepareToPublishIncrementals()
50+
junit 'target/surefire-reports/*.xml'
51+
}
4852
}
4953
}
54+
parallel branches
5055
}
51-
parallel branches
56+
// Stage part of the library
5257
infra.maybePublishIncrementals()

0 commit comments

Comments
 (0)