forked from jenkinsci/plugin-compat-tester
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
122 lines (103 loc) · 4.05 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/* Only keep the 10 most recent builds. */
properties([[$class: 'BuildDiscarderProperty',
strategy: [$class: 'LogRotator', numToKeepStr: '10']]])
// TODO: Move it to Jenkins Pipeline Library
/* These platforms correspond to labels in ci.jenkins.io, see:
* https://github.com/jenkins-infra/documentation/blob/master/ci.adoc
*/
List platforms = ['linux', 'windows']
Map branches = [:]
for (int i = 0; i < platforms.size(); ++i) {
String label = platforms[i]
branches[label] = {
node(label) {
timestamps {
stage('Checkout') {
checkout scm
}
stage('Build') {
withEnv([
"JAVA_HOME=${tool 'jdk8'}",
"PATH+MVN=${tool 'mvn'}/bin",
'PATH+JDK=$JAVA_HOME/bin',
]) {
timeout(30) {
String command = 'mvn --batch-mode clean install -Dmaven.test.failure.ignore=true'
if (isUnix()) {
sh command
}
else {
bat command
}
}
}
}
stage('Archive') {
/* Archive the test results */
junit '**/target/surefire-reports/TEST-*.xml'
if (label == 'linux') {
archiveArtifacts artifacts: '**/target/**/*.jar'
findbugs pattern: '**/target/findbugsXml.xml'
}
}
}
}
}
}
parallel(branches)
// Integration testing, using a locally built Docker image
def itBranches = [:]
itBranches['buildtriggerbadge:2.10 tests success on JDK11'] = {
node('docker') {
checkout scm
// should we build the image only once and somehow export and stash/unstash it then?
// not sure this would be that quicker
stage('Build Docker Image') {
sh 'make docker'
}
stage('Download Jenkins 2.164.1') {
sh '''
curl -sL http://mirrors.jenkins.io/war-stable/2.164.1/jenkins.war --output jenkins.war
echo "65543f5632ee54344f3351b34b305702df12393b3196a95c3771ddb3819b220b jenkins.war" | sha256sum --check
'''
}
stage("Run known successful case(s)") {
sh '''docker run --rm \
-v $(pwd)/jenkins.war:/pct/jenkins.war:ro \
-v $(pwd)/out:/pct/out -e JDK_VERSION=11 \
-e ARTIFACT_ID=buildtriggerbadge -e VERSION=buildtriggerbadge-2.10 \
jenkins/pct
'''
archiveArtifacts artifacts: "out/**"
sh 'cat out/pct-report.html | grep "Tests : Success"'
}
}
}
itBranches['buildtriggerbadge:2.10 tests success on JDK8'] = {
node('docker') {
checkout scm
// should we build the image only once and somehow export and stash/unstash it then?
// not sure this would be that quicker
stage('Build Docker Image') {
sh 'make docker'
}
stage('Download Jenkins 2.164.1') {
sh '''
curl -sL http://mirrors.jenkins.io/war-stable/2.164.1/jenkins.war --output jenkins.war
echo "65543f5632ee54344f3351b34b305702df12393b3196a95c3771ddb3819b220b jenkins.war" | sha256sum --check
'''
}
stage("Run known successful case(s)") {
sh '''docker run --rm \
-v $(pwd)/jenkins.war:/pct/jenkins.war:ro \
-v $(pwd)/out:/pct/out -e JDK_VERSION=8 \
-e ARTIFACT_ID=buildtriggerbadge -e VERSION=buildtriggerbadge-2.10 \
jenkins/pct
'''
archiveArtifacts artifacts: "out/**"
sh 'cat out/pct-report.html | grep "Tests : Success"'
}
}
}
itBranches.failFast = false
parallel itBranches