-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
325 lines (308 loc) · 11.6 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
def withGithubStatus(String context, Closure cl) {
def setGithubStatus = { String state ->
try {
def backref = "${BUILD_URL}flowGraphTable/"
def reposSourceURL = scm.repositories[0].getURIs()[0].toString()
step(
$class: 'GitHubCommitStatusSetter',
contextSource: [$class: "ManuallyEnteredCommitContextSource", context: context],
errorHandlers: [[$class: 'ShallowAnyErrorHandler']],
reposSource: [$class: 'ManuallyEnteredRepositorySource', url: reposSourceURL],
statusBackrefSource: [$class: 'ManuallyEnteredBackrefSource', backref: backref],
statusResultSource: [$class: 'ConditionalStatusResultSource', results: [[$class: 'AnyBuildResult', state: state]]],
)
} catch (err) {
echo "Exception from GitHubCommitStatusSetter for $context: $err"
}
}
setGithubStatus 'PENDING'
try {
cl()
} catch (err) {
// AbortException signals a "normal" build failure.
if (!(err instanceof hudson.AbortException)) {
echo "Exception in withGithubStatus for $context: $err"
}
setGithubStatus 'FAILURE'
throw err
}
setGithubStatus 'SUCCESS'
}
pipeline {
agent none
options {
buildDiscarder(logRotator(daysToKeepStr: '30'))
timeout(time: 3, unit: 'HOURS')
}
parameters {
booleanParam(name: 'janky', defaultValue: true, description: 'x86 Build/Test')
booleanParam(name: 'experimental', defaultValue: true, description: 'x86 Experimental Build/Test ')
booleanParam(name: 'z', defaultValue: true, description: 'IBM Z (s390x) Build/Test')
booleanParam(name: 'powerpc', defaultValue: true, description: 'PowerPC (ppc64le) Build/Test')
booleanParam(name: 'vendor', defaultValue: true, description: 'Vendor')
booleanParam(name: 'windowsRS1', defaultValue: true, description: 'Windows 2016 (RS1) Build/Test')
booleanParam(name: 'windowsRS5', defaultValue: true, description: 'Windows 2019 (RS5) Build/Test')
}
stages {
stage('Build') {
parallel {
stage('janky') {
when {
beforeAgent true
expression { params.janky }
}
agent {
node {
label 'ubuntu-1604-overlay2-stable'
}
}
steps {
withCredentials([string(credentialsId: '52af932f-f13f-429e-8467-e7ff8b965cdb', variable: 'CODECOV_TOKEN')]) {
withGithubStatus('janky') {
sh '''
# todo: include ip_vs in base image
sudo modprobe ip_vs
GITCOMMIT=$(git rev-parse --short HEAD)
docker build --rm --force-rm --build-arg APT_MIRROR=cdn-fastly.deb.debian.org -t docker:$GITCOMMIT .
docker run --rm -t --privileged \
-v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
-v "$WORKSPACE/.git:/go/src/github.com/docker/docker/.git" \
--name docker-pr$BUILD_NUMBER \
-e DOCKER_GITCOMMIT=${GITCOMMIT} \
-e DOCKER_GRAPHDRIVER=vfs \
-e DOCKER_EXECDRIVER=native \
-e CODECOV_TOKEN \
-e GIT_SHA1=${GIT_COMMIT} \
docker:$GITCOMMIT \
hack/ci/janky
'''
sh '''
GITCOMMIT=$(git rev-parse --short HEAD)
echo "Building e2e image"
docker build --build-arg DOCKER_GITCOMMIT=$GITCOMMIT -t moby-e2e-test -f Dockerfile.e2e .
'''
}
}
}
post {
always {
sh '''
echo "Ensuring container killed."
docker rm -vf docker-pr$BUILD_NUMBER || true
echo "Chowning /workspace to jenkins user"
docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
'''
sh '''
echo "Creating bundles.tar.gz"
(find bundles -name '*.log' -o -name '*.prof' -o -name integration.test | xargs tar -czf bundles.tar.gz) || true
'''
archiveArtifacts artifacts: 'bundles.tar.gz'
}
}
}
stage('experimental') {
when {
beforeAgent true
expression { params.experimental }
}
agent {
node {
label 'ubuntu-1604-aufs-stable'
}
}
steps {
withGithubStatus('experimental') {
sh '''
GITCOMMIT=$(git rev-parse --short HEAD)
docker build --rm --force-rm --build-arg APT_MIRROR=cdn-fastly.deb.debian.org -t docker:${GITCOMMIT}-exp .
docker run --rm -t --privileged \
-v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
-e DOCKER_EXPERIMENTAL=y \
--name docker-pr-exp$BUILD_NUMBER \
-e DOCKER_GITCOMMIT=${GITCOMMIT} \
-e DOCKER_GRAPHDRIVER=vfs \
-e DOCKER_EXECDRIVER=native \
docker:${GITCOMMIT}-exp \
hack/ci/experimental
'''
}
}
post {
always {
sh '''
echo "Ensuring container killed."
docker rm -vf docker-pr-exp$BUILD_NUMBER || true
echo "Chowning /workspace to jenkins user"
docker run --rm -v "$WORKSPACE:/workspace" busybox chown -R "$(id -u):$(id -g)" /workspace
'''
sh '''
echo "Creating bundles.tar.gz"
(find bundles -name '*.log' -o -name '*.prof' -o -name integration.test | xargs tar -czf bundles.tar.gz) || true
'''
archiveArtifacts artifacts: 'bundles.tar.gz'
}
}
}
stage('z') {
when {
beforeAgent true
expression { params.z }
}
agent {
node {
label 's390x-ubuntu-1604'
}
}
steps {
withGithubStatus('z') {
sh '''
GITCOMMIT=$(git rev-parse --short HEAD)
test -f Dockerfile.s390x && \
docker build --rm --force-rm --build-arg APT_MIRROR=cdn-fastly.deb.debian.org -t docker-s390x:$GITCOMMIT -f Dockerfile.s390x . || \
docker build --rm --force-rm --build-arg APT_MIRROR=cdn-fastly.deb.debian.org -t docker-s390x:$GITCOMMIT -f Dockerfile .
docker run --rm -t --privileged \
-v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
--name docker-pr-s390x$BUILD_NUMBER \
-e DOCKER_GRAPHDRIVER=vfs \
-e DOCKER_EXECDRIVER=native \
-e TIMEOUT="300m" \
-e DOCKER_GITCOMMIT=${GITCOMMIT} \
docker-s390x:$GITCOMMIT \
hack/ci/z
'''
}
}
post {
always {
sh '''
echo "Ensuring container killed."
docker rm -vf docker-pr-s390x$BUILD_NUMBER || true
echo "Chowning /workspace to jenkins user"
docker run --rm -v "$WORKSPACE:/workspace" s390x/busybox chown -R "$(id -u):$(id -g)" /workspace
'''
sh '''
echo "Creating bundles.tar.gz"
find bundles -name '*.log' | xargs tar -czf bundles.tar.gz
'''
archiveArtifacts artifacts: 'bundles.tar.gz'
}
}
}
stage('powerpc') {
when {
beforeAgent true
expression { params.powerpc }
}
agent {
node {
label 'ppc64le-ubuntu-1604'
}
}
steps {
withGithubStatus('powerpc') {
sh '''
GITCOMMIT=$(git rev-parse --short HEAD)
test -f Dockerfile.ppc64le && \
docker build --rm --force-rm --build-arg APT_MIRROR=cdn-fastly.deb.debian.org -t docker-powerpc:$GITCOMMIT -f Dockerfile.ppc64le . || \
docker build --rm --force-rm --build-arg APT_MIRROR=cdn-fastly.deb.debian.org -t docker-powerpc:$GITCOMMIT -f Dockerfile .
docker run --rm -t --privileged \
-v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \
--name docker-pr-power$BUILD_NUMBER \
-e DOCKER_GRAPHDRIVER=vfs \
-e DOCKER_EXECDRIVER=native \
-e DOCKER_GITCOMMIT=${GITCOMMIT} \
-e TIMEOUT="180m" \
docker-powerpc:$GITCOMMIT \
hack/ci/powerpc
'''
}
}
post {
always {
sh '''
echo "Ensuring container killed."
docker rm -vf docker-pr-power$BUILD_NUMBER || true
echo "Chowning /workspace to jenkins user"
docker run --rm -v "$WORKSPACE:/workspace" ppc64le/busybox chown -R "$(id -u):$(id -g)" /workspace
'''
sh '''
echo "Creating bundles.tar.gz"
find bundles -name '*.log' | xargs tar -czf bundles.tar.gz
'''
archiveArtifacts artifacts: 'bundles.tar.gz'
}
}
}
stage('vendor') {
when {
beforeAgent true
expression { params.vendor }
}
agent {
node {
label 'ubuntu-1604-aufs-stable'
}
}
steps {
withGithubStatus('vendor') {
sh '''
GITCOMMIT=$(git rev-parse --short HEAD)
docker build --rm --force-rm --build-arg APT_MIRROR=cdn-fastly.deb.debian.org -t dockerven:$GITCOMMIT .
docker run --rm -t --privileged \
--name dockerven-pr$BUILD_NUMBER \
-e DOCKER_GRAPHDRIVER=vfs \
-e DOCKER_EXECDRIVER=native \
-v "$WORKSPACE/.git:/go/src/github.com/docker/docker/.git" \
-e DOCKER_GITCOMMIT=${GITCOMMIT} \
-e TIMEOUT=120m dockerven:$GITCOMMIT \
hack/validate/vendor
'''
}
}
}
stage('windowsRS1') {
when {
beforeAgent true
expression { params.windowsRS1 }
}
agent {
node {
label 'windows-rs1'
customWorkspace 'c:\\gopath\\src\\github.com\\docker\\docker'
}
}
steps {
withGithubStatus('windowsRS1') {
powershell '''
$ErrorActionPreference = 'Stop'
.\\hack\\ci\\windows.ps1
exit $LastExitCode
'''
}
}
}
stage('windowsRS5-process') {
when {
beforeAgent true
expression { params.windowsRS5 }
}
agent {
node {
label 'windows-rs5'
customWorkspace 'c:\\gopath\\src\\github.com\\docker\\docker'
}
}
steps {
withGithubStatus('windowsRS5-process') {
powershell '''
$ErrorActionPreference = 'Stop'
.\\hack\\ci\\windows.ps1
exit $LastExitCode
'''
}
}
}
}
}
}
}