This repository was archived by the owner on Apr 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathJenkinsfile
More file actions
443 lines (438 loc) · 21.6 KB
/
Jenkinsfile
File metadata and controls
443 lines (438 loc) · 21.6 KB
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
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
#!/usr/bin/groovy
/* Copyright (C) 2019 Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted for any purpose (including commercial purposes)
* provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions, and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions, and the following disclaimer in the
* documentation and/or materials provided with the distribution.
*
* 3. In addition, redistributions of modified forms of the source or binary
* code must carry prominent notices stating that the original code was
* changed and the date of the change.
*
* 4. All publications or advertising materials mentioning features or use of
* this software are asked, but not required, to acknowledge that it was
* developed by Intel Corporation and credit the contributors.
*
* 5. Neither the name of Intel Corporation, nor the name of any Contributor
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
def sanitized_JOB_NAME = JOB_NAME.toLowerCase().replaceAll('/', '-').replaceAll('%2f', '-')
pipeline {
agent { label 'lightweight' }
environment {
GITHUB_USER = credentials('daos-jenkins-review-posting')
BAHTTPS_PROXY = "${env.HTTP_PROXY ? '--build-arg HTTP_PROXY="' + env.HTTP_PROXY + '" --build-arg http_proxy="' + env.HTTP_PROXY + '"' : ''}"
BAHTTP_PROXY = "${env.HTTP_PROXY ? '--build-arg HTTPS_PROXY="' + env.HTTPS_PROXY + '" --build-arg https_proxy="' + env.HTTPS_PROXY + '"' : ''}"
UID=sh(script: "id -u", returnStdout: true)
BUILDARGS = "--build-arg NOBUILD=1 --build-arg UID=$env.UID $env.BAHTTP_PROXY $env.BAHTTPS_PROXY"
}
options {
// preserve stashes so that jobs can be started at the test stage
preserveStashes(buildCount: 5)
timestamps ()
}
stages {
stage('Cancel Previous Builds') {
when { changeRequest() }
steps {
cancelPreviousBuilds()
}
}
stage('Pre-build') {
parallel {
stage('checkpatch') {
agent {
dockerfile {
filename 'Dockerfile.centos:7'
dir 'utils/docker'
label 'docker_runner'
additionalBuildArgs "-t ${sanitized_JOB_NAME}-centos7 " + '$BUILDARGS'
}
}
steps {
checkPatch user: GITHUB_USER_USR,
password: GITHUB_USER_PSW
}
post {
always {
archiveArtifacts artifacts: 'pylint.log', allowEmptyArchive: true
}
}
}
}
}
stage('Build') {
/* Don't use failFast here as whilst it avoids using extra resources
* and gives faster results for PRs it's also on for master where we
* do want complete results in the case of partial failure
*/
//failFast true
parallel {
stage('Build on CentOS 7') {
agent {
dockerfile {
filename 'Dockerfile.centos:7'
dir 'utils/docker'
label 'docker_runner'
additionalBuildArgs "-t ${sanitized_JOB_NAME}-centos7 " + '$BUILDARGS'
}
}
steps {
sconsBuild(clean: '_build.external')
stash name: 'CentOS-install', includes: 'install/**'
stash name: 'CentOS-build-vars', includes: '.build_vars.*'
}
post {
always {
node('lightweight') {
recordIssues enabledForFailure: true,
aggregatingResults: true,
id: "analysis-centos7",
tools: [ gcc4(), cppCheck() ],
filters: [excludeFile(".*\\/_build\\.external\\/.*"),
excludeFile("_build\\.external\\/.*")]
}
}
}
}
stage('Build master CentOS 7') {
when { branch 'master' }
agent {
dockerfile {
filename 'Dockerfile.centos:7'
dir 'utils/docker'
label 'docker_runner'
additionalBuildArgs "-t ${sanitized_JOB_NAME}-centos7 " + '$BUILDARGS'
}
}
steps {
sconsBuild(clean: '_build.external',
scons_args: '--build-config=utils/build-master.config')
stash name: 'CentOS-master-install', includes: 'install/**'
stash name: 'CentOS-master-build-vars', includes: ".build_vars.*"
}
post {
always {
node('lightweight') {
recordIssues enabledForFailure: true,
aggregatingResults: true,
id: "analysis-master-centos7",
tools: [ gcc4(), cppCheck() ],
filters: [excludeFile('.*\\/_build\\.external\\/.*'),
excludeFile('_build\\.external\\/.*')]
}
}
}
}
stage('Build on Ubuntu 18.04') {
agent {
dockerfile {
filename 'Dockerfile.ubuntu:18.04'
dir 'utils/docker'
label 'docker_runner'
additionalBuildArgs "-t ${sanitized_JOB_NAME}-ubuntu18.04 " + '$BUILDARGS'
}
}
steps {
sconsBuild(clean: '_build.external')
}
post {
always {
node('lightweight') {
recordIssues enabledForFailure: true,
aggregatingResults: true,
id: "analysis-ubuntu18",
tools: [ gcc4(), cppCheck() ],
filters: [excludeFile(".*\\/_build\\.external\\/.*"),
excludeFile("_build\\.external\\/.*")]
}
}
}
}
}
}
stage('Test') {
parallel {
stage('Single node') {
agent {
label 'ci_vm1'
}
options {
timeout(time: 60, unit: 'MINUTES')
}
steps {
provisionNodes NODELIST: env.NODELIST,
node_count: 1,
snapshot: true
runTest stashes: [ 'CentOS-install', 'CentOS-build-vars' ],
script: """set -x
. ./.build_vars.sh
IOF_BASE=\${SL_PREFIX%/install*}
NODELIST=$nodelist
NODE=\${NODELIST%%,*}
trap 'set +e; set -x; ssh -i ci_key jenkins@\$NODE "set -ex; sudo umount \$IOF_BASE"' EXIT
ssh -i ci_key jenkins@\$NODE "set -x
set -e
sudo mkdir -p \$IOF_BASE
sudo mount -t nfs \$HOSTNAME:\$PWD \$IOF_BASE
cd \$IOF_BASE
ln -s /usr/bin/fusermount install/bin/fusermount3
pip3 install --user tabulate
export TR_USE_VALGRIND=none
export IOF_TESTLOG=test/output-centos
nosetests-3.6 --xunit-testsuite-name=centos --xunit-file=nosetests-centos.xml --exe --with-xunit"
exit 0
""",
junit_files: 'nosetests-centos.xml'
}
post {
always {
junit 'nosetests-centos.xml'
archiveArtifacts artifacts: '**/*.log'
}
cleanup {
dir('test/output-centos') {
deleteDir()
}
}
}
}
stage('Single node cart-master') {
when { branch 'master' }
agent {
label 'ci_vm1'
}
options {
timeout(time: 60, unit: 'MINUTES')
}
/* To run a single test use this command:
* nosetests-3.6 --with-xunit --xunit-testsuite-name=master --xunit-file=nosetests-master.xml test/iof_test_local.py:Testlocal.test_use_ino"
*/
steps {
provisionNodes NODELIST: env.NODELIST,
node_count: 1,
snapshot: true
runTest stashes: [ 'CentOS-master-install', 'CentOS-master-build-vars' ],
script: """set -x
. ./.build_vars.sh
IOF_BASE=\${SL_PREFIX%/install*}
NODELIST=$nodelist
NODE=\${NODELIST%%,*}
trap 'set +e; set -x; ssh -i ci_key jenkins@\$NODE "set -ex; sudo umount \$IOF_BASE"' EXIT
ssh -i ci_key jenkins@\$NODE "set -x
set -e
sudo mkdir -p \$IOF_BASE
sudo mount -t nfs \$HOSTNAME:\$PWD \$IOF_BASE
cd \$IOF_BASE
ln -s /usr/bin/fusermount install/bin/fusermount3
pip3 install --user tabulate
export TR_USE_VALGRIND=none
export IOF_TESTLOG=test/output-master
nosetests-3.6 --xunit-testsuite-name=master --xunit-file=nosetests-master.xml --exe --with-xunit"
exit 0
""",
junit_files: 'nosetests-master.xml'
}
post {
always {
junit 'nosetests-master.xml'
archiveArtifacts artifacts: '**/*.log'
}
cleanup {
dir('test/output-master') {
deleteDir()
}
}
}
}
stage('Single node valgrind') {
agent {
label 'ci_vm1'
}
options {
timeout(time: 60, unit: 'MINUTES')
}
steps {
provisionNodes NODELIST: env.NODELIST,
node_count: 1,
snapshot: true
runTest stashes: [ 'CentOS-install', 'CentOS-build-vars' ],
script: """set -x
. ./.build_vars.sh
IOF_BASE=\${SL_PREFIX%/install*}
NODELIST=$nodelist
NODE=\${NODELIST%%,*}
trap 'set +e; set -x; ssh -i ci_key jenkins@\$NODE "set -ex; sudo umount \$IOF_BASE"' EXIT
ssh -i ci_key jenkins@\$NODE "set -x
set -e
sudo mkdir -p \$IOF_BASE
sudo mount -t nfs \$HOSTNAME:\$PWD \$IOF_BASE
cd \$IOF_BASE
ln -s /usr/bin/fusermount install/bin/fusermount3
pip3 install --user tabulate
export TR_USE_VALGRIND=memcheck
export IOF_TESTLOG=test/output-memcheck
nosetests-3.6 --xunit-testsuite-name=valgrind --xunit-file=nosetests-valgrind.xml --exe --with-xunit"
exit 0
""",
junit_files: 'nosetests-valgrind.xml'
}
post {
always {
junit 'nosetests-valgrind.xml'
archiveArtifacts artifacts: '**/*.log,**/*.memcheck'
publishValgrind (
failBuildOnInvalidReports: true,
failBuildOnMissingReports: true,
failThresholdDefinitelyLost: '0',
failThresholdInvalidReadWrite: '0',
failThresholdTotal: '0',
pattern: '**/*.memcheck',
publishResultsForAbortedBuilds: false,
publishResultsForFailedBuilds: false,
sourceSubstitutionPaths: '',
unstableThresholdDefinitelyLost: '',
unstableThresholdInvalidReadWrite: '',
unstableThresholdTotal: ''
)
}
cleanup {
dir('test/output-memcheck') {
deleteDir()
}
}
}
}
stage('Fault injection') {
agent {
label 'ci_vm1'
}
options {
timeout(time: 60, unit: 'MINUTES')
}
steps {
provisionNodes NODELIST: env.NODELIST,
node_count: 1,
snapshot: true
runTest stashes: [ 'CentOS-install', 'CentOS-build-vars' ],
script: """set -x
. ./.build_vars.sh
IOF_BASE=\${SL_PREFIX%/install*}
NODELIST=$nodelist
NODE=\${NODELIST%%,*}
trap 'set +e; set -x; ssh -i ci_key jenkins@\$NODE "set -ex; sudo umount \$IOF_BASE"' EXIT
ssh -i ci_key jenkins@\$NODE "set -x
set -e
sudo mkdir -p \$IOF_BASE
sudo mount -t nfs \$HOSTNAME:\$PWD \$IOF_BASE
cd \$IOF_BASE
ln -s /usr/bin/fusermount install/bin/fusermount3
pip3 install --user tabulate
export IOF_TESTLOG=test/output-fi
./test/iof_test_alloc_fail.py"
"""
}
post {
always {
archiveArtifacts artifacts: '**/*.log,test/output-fi/**/*.memcheck'
publishValgrind (
failBuildOnInvalidReports: true,
failBuildOnMissingReports: true,
failThresholdDefinitelyLost: '0',
failThresholdInvalidReadWrite: '0',
failThresholdTotal: '0',
pattern: 'test/output-fi/**/*.memcheck',
publishResultsForAbortedBuilds: false,
publishResultsForFailedBuilds: false,
sourceSubstitutionPaths: '',
unstableThresholdDefinitelyLost: '',
unstableThresholdInvalidReadWrite: '',
unstableThresholdTotal: ''
)
}
cleanup {
dir('test/output') {
deleteDir()
}
}
}
}
stage('Fault Injection using cart master') {
when { branch 'master' }
agent {
label 'ci_vm1'
}
options {
timeout(time: 60, unit: 'MINUTES')
}
steps {
provisionNodes NODELIST: env.NODELIST,
node_count: 1,
snapshot: true
runTest stashes: [ 'CentOS-master-install', 'CentOS-master-build-vars' ],
script: """set -x
. ./.build_vars.sh
IOF_BASE=\${SL_PREFIX%/install*}
NODELIST=$nodelist
NODE=\${NODELIST%%,*}
trap 'set +e; set -x; ssh -i ci_key jenkins@\$NODE "set -ex; sudo umount \$IOF_BASE"' EXIT
ssh -i ci_key jenkins@\$NODE "set -x
set -e
sudo mkdir -p \$IOF_BASE
sudo mount -t nfs \$HOSTNAME:\$PWD \$IOF_BASE
cd \$IOF_BASE
ln -s /usr/bin/fusermount install/bin/fusermount3
pip3 install --user tabulate
export IOF_TESTLOG=test/output-master-fi
./test/iof_test_alloc_fail.py"
"""
}
post {
always {
archiveArtifacts artifacts: '**/*.log,test/output-master-fi/**/*.memcheck'
publishValgrind (
failBuildOnInvalidReports: true,
failBuildOnMissingReports: true,
failThresholdDefinitelyLost: '0',
failThresholdInvalidReadWrite: '0',
failThresholdTotal: '0',
pattern: 'test/output-master-fi/**/*.memcheck',
publishResultsForAbortedBuilds: false,
publishResultsForFailedBuilds: false,
sourceSubstitutionPaths: '',
unstableThresholdDefinitelyLost: '',
unstableThresholdInvalidReadWrite: '',
unstableThresholdTotal: ''
)
}
cleanup {
dir('test/output') {
deleteDir()
}
}
}
}
}
}
}
}