blob: 2ab181513a82f38967f8c59687e747f1df712d61 (
plain)
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
|
- defaults:
name: platform-ci-workflow-provision-teardown
description: |
Managed by Jenkins Job Builder. Do not edit via web.
concurrent: true
scm:
- git:
url: 'http://git.engineering.redhat.com/git/users/bpeck/ci-ops-central.git'
#url: 'https://code.engineering.redhat.com/gerrit/ci-ops-central'
branches:
- origin/testing
basedir: ci-ops-central
- git:
url: 'https://code.engineering.redhat.com/gerrit/ci-ops-projex'
branches:
- origin/master
basedir: ci-ops-projex
- git:
url: 'https://code.engineering.redhat.com/gerrit/job-runner'
branches:
- origin/master
basedir: job-runner
- git:
url: 'http://git.engineering.redhat.com/git/users/bpeck/tests.git'
branches:
- origin/master
basedir: tests
wrappers:
- default-platform-ci-workflow-wrappers
- defaults:
name: platform-ci-workflow-runtest
description: |
Managed by Jenkins Job Builder. Do not edit via web.
concurrent: true
scm:
- git:
url: 'https://code.engineering.redhat.com/gerrit/ci-ops-central'
branches:
- origin/master
basedir: ci-ops-central
- git:
url: 'http://git.app.eng.bos.redhat.com/git/ci-ops-projex.git'
branches:
- origin/master
basedir: ci-ops-projex
- git:
url: 'http://git.engineering.redhat.com/git/users/bpeck/tests.git'
branches:
- origin/master
basedir: tests
wrappers:
- default-platform-ci-workflow-wrappers
- default-platform-ci-workflow-build-timeout-wrapper
- wrapper:
name: default-platform-ci-workflow-wrappers
wrappers:
- ansicolor
- workspace-cleanup
- timestamps
- wrapper:
name: default-platform-ci-workflow-build-timeout-wrapper
wrappers:
- timeout:
timeout-var: 'BUILD_TIMEOUT'
fail: true
elastic-percentage: 150
elastic-default-timeout: 90
type: elastic
- publisher:
name: default-platform-ci-workflow-publishers
publishers:
- email-ext:
recipients: $DEFAULT_RECIPIENTS
reply-to: $DEFAULT_REPLYTO
content-type: default
subject: $DEFAULT_SUBJECT
body: $DEFAULT_CONTENT
attach-build-log: false
always: true
unstable: true
first-failure: true
not-built: true
aborted: true
regression: true
failure: true
improvement: true
still-failing: true
success: true
fixed: true
still-unstable: true
pre-build: true
matrix-trigger: only-configurations
send-to:
- requester
- recipients
- publisher:
name: default-platform-ci-workflow-runtest-publishers
publishers:
- xunit:
thresholdmode: 'number'
thresholds:
- failed:
unstable: 0
unstablenew: 0
failure: 0
failurenew: 0
- skipped:
unstable: 0
unstablenew: 0
failure: 0
failurenew: 0
types:
- junit:
pattern: '*.xml'
deleteoutput: false
- job-template:
name: '{project}-1-brew-msg-trigger'
defaults: platform-ci-workflow-provision-teardown
node: master
triggers:
- ci-trigger:
jms-selector: 'CI_TYPE = ''brew-taskstatechange'' AND method = ''build'' AND package = ''restraint'''
builders:
- shell: |
#!/bin/bash
# Set $KEYTAB and $PRINCIPAL up as global vars in Jenkins
kinit -k -t $KEYTAB $PRINCIPAL
abcli repo --brew-taskid=$id | tail -1 | sed 's/\(.*\)$/AUTOBKR_REPO=\1/' >> $WORKSPACE/CI_MESSAGE_ENV.txt
- inject:
properties-file: $WORKSPACE/CI_MESSAGE_ENV.txt
publishers:
- archive:
artifacts: '*.txt, *.json'
allow-empty: 'true'
- trigger-parameterized-builds:
- project: '{project}-2-provision'
current-parameters: true
condition: 'SUCCESS'
- job-template:
name: '{project}-2-provision'
defaults: platform-ci-workflow-provision-teardown
node: '{jslavename}'
retry-count: 3
parameters:
- choice:
name: SITE
choices:
- qeos
- os1
description: |
Site where to provision resources
builders:
- shell: |
#!/bin/bash
export JSLAVENAME={jslavename}
# Provision Jenkins Slave
if [ "$JSLAVENAME" != "master" ]
then
$WORKSPACE/ci-ops-central/bootstrap/provision_jslave.sh --site=$SITE --project_defaults={project_defaults} \
--topology=ci-ops-central/project/config/aio_jslave --ssh_keyfile={ssh_keyfile} \
--jslavename={jslavename} --jslaveflavor={jslaveflavor} --jslaveimage={jslaveimage} \
--jslave_execs={jslave_execs} --jslavecreate --resources_file={jslavename}.json
TR_STATUS=$?
if [ "$TR_STATUS" != 0 ]; then echo "ERROR: Provisioning\nSTATUS: $TR_STATUS"; exit 1; fi
fi
# Provision Test Resources
$WORKSPACE/ci-ops-central/bootstrap/provision_resources.sh --site=$SITE --project_defaults={project_defaults} \
--topology={topology_path}/${{target}} --ssh_keyfile={ssh_keyfile} --name={project}
TR_STATUS=$?
files=$(ls $WORKSPACE/*.slave 2>/dev/null)
if [ -e "$files" ]
then
cat $WORKSPACE/*.slave >> $WORKSPACE/RESOURCES.txt
fi
if [ "$TR_STATUS" != 0 ]; then echo "ERROR: Provisioning\nSTATUS: $TR_STATUS"; exit 1; fi
- inject:
properties-file: $WORKSPACE/RESOURCES.txt
publishers:
- archive:
artifacts: '*.txt, *.json'
allow-empty: 'true'
- trigger-parameterized-builds:
- project: '{project}-3-runtest'
current-parameters: true
condition: 'SUCCESS'
property-file: $WORKSPACE/RESOURCES.txt
fail-on-missing: true
- project: '{project}-4-teardown'
current-parameters: true
condition: 'UNSTABLE_OR_WORSE'
property-file: $WORKSPACE/RESOURCES.txt
fail-on-missing: true
- job-template:
name: '{project}-3-runtest'
defaults: platform-ci-workflow-runtest
node: master
parameters:
- string:
name: JOBXMLTEMP
default: '{project}-sanity.xml'
description: |
Beaker job xml name
- string:
name: SSH_KEYFILE
default: ci-ops-projex/config/keys/ci-ops-central
description: |
Private SSH key to use for authentication
builders:
- copyartifact:
project: '{project}-2-provision'
filter: '*.txt, *.json'
target: $WORKSPACE
- shell: |
#!/bin/bash
export DEBUGLEVEL=DEBUG
echo "DEBUG: $DEBUGLEVEL"
env
chmod go-rw ${{SSH_KEYFILE}}
export BKRID=$(echo ${{BKR_JOBID}} | awk -F: '{{print $2}}')
if ! [ -z ${{BKRID}} ]
then
echo "BKRID: ${{BKRID}}"
export UUID=${{BKRID}}
else
export UUID=$(uuidgen)
fi
if [ -f $WORKSPACE/tests/restraint/config/${{JOBXMLTEMP}} ] ; then
cp $WORKSPACE/tests/restraint/config/${{JOBXMLTEMP}} $WORKSPACE/${{UUID}}_${{JOBXMLTEMP}}
export JOBXML=$WORKSPACE/${{UUID}}_${{JOBXMLTEMP}}
echo "JOBXML: ${{JOBXML}}"
sed -i "s/##PKGNAME##/${{name}}/g" ${{JOBXML}}
sed -i "s|##BASEURL##|${{AUTOBKR_REPO}}|g" ${{JOBXML}}
else
echo "Missing job xml"
exit 1
fi
#set PYTHONPATH
export PYTHONPATH=$PWD/ci-ops-central/
env | grep PYTHONPATH
#run task runner to execute restraint
taskrunner -f $WORKSPACE/ci-ops-central/targets/restraint.py restraint_pipeline
rc=$?
if [ $rc -eq 0 ];then
echo "Platform Test Successful : " $rc
else
echo "Platform Test Failed : " $rc
exit $rc
fi
echo "====================================================="
echo
echo
# Generate xUnit Results
for d in $(find . -type d -iname "${{UUID}}_*") ; do
echo "Processing results in $d"
xsltproc /usr/share/restraint/client/job2html.xml $d/job.xml > $d/index.html
xsltproc /usr/share/restraint/client/job2junit.xml $d/job.xml > $d/xUnit.xml
done
publishers:
- archive:
artifacts: '**/**'
allow-empty: 'true'
- default-platform-ci-workflow-runtest-publishers
- trigger-parameterized-builds:
- project: '{project}-4-teardown'
current-parameters: true
- job-template:
name: '{project}-4-teardown'
defaults: platform-ci-workflow-provision-teardown
node: master
builders:
- shell: |
#!/bin/bash
export JSLAVETEARDOWN={jslaveteardown}
# Teardown Jenkins Slave
$WORKSPACE/ci-ops-central/bootstrap/teardown_resources.sh --site=$SITE --project_defaults={project_defaults} \
--topology={topology_path}/${{target}} --name=$LABEL
TR_STATUS=$?
if [ "$TR_STATUS" != 0 ]; then echo "ERROR: Teardown\nSTATUS: $TR_STATUS"; exit 1; fi
if [ "$JSLAVETEARDOWN" == "True" ]
then
$WORKSPACE/ci-ops-central/bootstrap/teardown_jslave.sh --site=$SITE --project_defaults={project_defaults} \
--topology=ci-ops-central/project/config/aio_jslave --jslavename=$JSLAVENAME \
--jslaveusername={jslaveusername} --jslavepassword={jslavepassword} --jslaveip=$JSLAVEIP --jslaveteardown
TR_STATUS=$?
if [ "$TR_STATUS" != 0 ]; then echo "ERROR: Teardown\nSTATUS: $TR_STATUS"; exit 1; fi
fi
- job-group:
name: platform-trigger-provision-runtest-teardown
jobs:
- '{project}-1-brew-msg-trigger'
- '{project}-2-provision'
- '{project}-3-runtest'
- '{project}-4-teardown'
- project:
name: platform-jobs
project:
- restraint
project_defaults:
- ci-ops-projex/config/project_defaults
topology_path:
- tests/restraint/config
topology:
- bkr
ssh_keyfile:
- ci-ops-projex/config/keys/ci-ops-central
jobs:
- platform-trigger-provision-runtest-teardown
jslavename:
- master
jslave_execs:
- 10
jslave_topology:
- restraint
jslaveimage:
- pit-slave-rhel-6.5-x86-64_rev3
jslaveflavor:
- m1.large
jslaveusername:
- root
jslavepassword:
- redhat
jslaveteardown:
- False
|