forked from jenkinsci/acceptance-test-harness
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathJenkinsfile
64 lines (59 loc) · 2.89 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// For ci.jenkins.io
// https://github.com/jenkins-infra/documentation/blob/master/ci.adoc
properties([disableConcurrentBuilds(abortPrevious: true)])
def branches = [:]
def splits
def needSplittingFromWorkspace = true
for (build = currentBuild.previousCompletedBuild; build != null; build = build.previousCompletedBuild) {
if (build.resultIsBetterOrEqualTo("UNSTABLE")) {
// we have a reference build
echo "not splitting from workspace, reference build should be : ${build.projectName}:${build.number}, with state ${build.result}"
needSplittingFromWorkspace = false
break
}
}
if (needSplittingFromWorkspace) {
node() { // When there are no previous build, we need to estimate splits from files which require workspace
checkout scm
splits = splitTests estimateTestsFromFiles: true, parallelism: count(10)
}
} else {
splits = splitTests count(10)
}
for (int i = 0; i < splits.size(); i++) {
int index = i
for (int j in [8, 11]) {
int javaVersion = j
def name = "java-${javaVersion}-split${index}"
branches[name] = {
stage(name) {
node('docker && highmem') {
checkout scm
def image = docker.build('jenkins/ath', '--build-arg uid="$(id -u)" --build-arg gid="$(id -g)" ./src/main/resources/ath-container/')
image.inside('-v /var/run/docker.sock:/var/run/docker.sock --shm-size 2g') {
def exclusions = splits.get(index).join("\n")
writeFile file: 'excludes.txt', text: exclusions
realtimeJUnit(
testResults: 'target/surefire-reports/TEST-*.xml',
testDataPublishers: [[$class: 'AttachmentPublisher']],
// Slow test(s) removal can causes a split to get empty which otherwise fails the build.
// The build failure prevents parallel tests executor to realize the tests are gone so same
// split is run to execute and report zero tests - which fails the build. Permit the test
// results to be empty to break the circle: build after removal executes one empty split
// but not letting the build to fail will cause next build not to try those tests again.
allowEmptyResults: true
) {
sh """
set-java.sh $javaVersion
eval \$(vnc.sh)
java -version
run.sh firefox latest -Dmaven.test.failure.ignore=true -DforkCount=1 -B
"""
}
}
}
}
}
}
}
parallel branches