Take DEBUG into account in gates
[releng.git] / jjb / functest / xtesting.yaml
1 ---
2 - xtesting-jobs: &xtesting-jobs
3     name: 'xtesting-jobs'
4     current-parameters: true
5
6 - xtesting-params: &xtesting-params
7     name: 'xtesting-params'
8     repo: 'opnfv'
9     port:
10     tag:
11       - latest:
12           branch: master
13       - iruya:
14           branch: stable/iruya
15       - hunter:
16           branch: stable/hunter
17
18 - parameter:
19     name: xtesting-slave
20     parameters:
21       - label:
22           name: slave
23           default: lf-build2
24
25 - parameter:
26     name: xtesting-branch
27     parameters:
28       - string:
29           name: branch
30           default: '{branch}'
31
32 - xtesting-containers: &xtesting-containers
33     name: 'xtesting-containers'
34     repo: '{repo}'
35     port: '{port}'
36     container: '{container}'
37     tag: '{tag}'
38
39 - xtesting-run-containers: &xtesting-run-containers
40     name: 'xtesting-build-containers'
41     <<: *xtesting-containers
42     test: '{test}'
43
44 - xtesting-build-containers: &xtesting-build-containers
45     name: 'xtesting-build-containers'
46     <<: *xtesting-containers
47     ref_arg: '{ref_arg}'
48     path: '{path}'
49
50 - builder:
51     name: xtesting-pull-containers
52     builders:
53       - shell: |
54           set +x
55           if [ "{repo}" = "_" ]; then
56             image={container}:{tag}
57           elif [ "{port}" = "None" ]; then
58             image={repo}/{container}:{tag}
59           else
60             image={repo}:{port}/{container}:{tag}
61           fi
62           sudo docker pull $image
63
64 - builder:
65     name: xtesting-build-containers
66     builders:
67       - shell: |
68           set +x
69           if [ "{repo}" = "_" ]; then
70             image={container}:{tag}
71           elif [ "{port}" = "None" ]; then
72             image={repo}/{container}:{tag}
73           else
74             image={repo}:{port}/{container}:{tag}
75           fi
76           if [ "{ref_arg}" = "None" ]; then
77             build_arg=""
78           else
79             build_arg="--build-arg {ref_arg}={ref}"
80           fi
81           cd {path}
82           sudo docker build $build_arg \
83             --pull=false --no-cache --force-rm=true \
84             -t $image .
85
86 - builder:
87     name: xtesting-run-containers
88     builders:
89       - shell: |
90           set +ex
91           [ ! -z "$WORKSPACE" ] && sudo rm -rf $WORKSPACE/* || true
92           if [ "{repo}" = "_" ]; then
93             image={container}:{tag}
94           elif [ "{port}" = "None" ]; then
95             image={repo}/{container}:{tag}
96           else
97             image={repo}:{port}/{container}:{tag}
98           fi
99           sudo docker run --rm \
100             -v $WORKSPACE/../$JOB_NAME/results:/var/lib/xtesting/results \
101             -e DEBUG=true \
102             $image run_tests -t {test}
103           res=$?
104           gsutil -m cp -r $WORKSPACE/ \
105             gs://artifacts.opnfv.org/xtesting/$JOB_NAME-$BUILD_ID > /dev/null 2>&1
106           find $WORKSPACE -type f \
107             -printf \
108             "http://artifacts.opnfv.org/xtesting/$JOB_NAME-$BUILD_ID/%P\n"
109           exit $res
110
111 - builder:
112     name: xtesting-remove-images
113     builders:
114       - shell: |
115           set +x
116           if [ "{repo}" = "_" ]; then
117             image={container}:{tag}
118           elif [ "{port}" = "None" ]; then
119             image={repo}/{container}:{tag}
120           else
121             image={repo}:{port}/{container}:{tag}
122           fi
123           sudo docker rmi $image || true
124
125 - scm:
126     name: xtesting-scm
127     scm:
128       - git:
129           url: https://gerrit.opnfv.org/gerrit/functest-xtesting
130           refspec: '+refs/changes/*:refs/changes/*'
131           branches:
132             - '{ref}'
133
134 - job-template:
135     name: 'xtesting-{repo}-{container}-{tag}-pull'
136     parameters:
137       - xtesting-slave
138     builders:
139       - xtesting-pull-containers:
140           <<: *xtesting-containers
141
142 - project:
143     name: 'xtesting-opnfv-xtesting-pull'
144     <<: *xtesting-params
145     container: 'xtesting'
146     jobs:
147       - 'xtesting-{repo}-{container}-{tag}-pull'
148
149 - job-template:
150     name: 'xtesting-{repo}-{container}-{tag}-rmi'
151     parameters:
152       - xtesting-slave
153     builders:
154       - xtesting-remove-images:
155           <<: *xtesting-containers
156
157 - project:
158     name: 'xtesting-opnfv-xtesting-rmi'
159     <<: *xtesting-params
160     container: 'xtesting'
161     jobs:
162       - 'xtesting-{repo}-{container}-{tag}-rmi'
163
164 - job-template:
165     name: 'xtesting-{repo}-{container}-{tag}-{test}-run'
166     parameters:
167       - xtesting-slave
168     builders:
169       - xtesting-run-containers:
170           <<: *xtesting-run-containers
171
172 - project:
173     name: 'xtesting-opnfv-xtesting'
174     <<: *xtesting-params
175     container: 'xtesting'
176     test:
177       - first
178       - second
179       - third
180       - fourth
181       - fifth
182     jobs:
183       - 'xtesting-{repo}-{container}-{tag}-{test}-run'
184
185 - job-template:
186     name: 'xtesting-{tag}-daily'
187     project-type: multijob
188     triggers:
189       - timed: '@daily'
190     parameters:
191       - xtesting-slave
192     properties:
193       - build-blocker:
194           use-build-blocker: true
195           blocking-level: 'NODE'
196           blocking-jobs:
197             - '^xtesting-[a-z]+-(daily|check|gate)$'
198     builders:
199       - multijob:
200           name: remove former images
201           projects:
202             - name: 'xtesting-opnfv-xtesting-{tag}-rmi'
203               <<: *xtesting-jobs
204       - multijob:
205           name: pull containers
206           projects:
207             - name: 'xtesting-opnfv-xtesting-{tag}-pull'
208               <<: *xtesting-jobs
209       - multijob:
210           name: opnfv/xtesting:{tag}
211           projects:
212             - name: 'xtesting-opnfv-xtesting-{tag}-first-run'
213               <<: *xtesting-jobs
214             - name: 'xtesting-opnfv-xtesting-{tag}-second-run'
215               <<: *xtesting-jobs
216             - name: 'xtesting-opnfv-xtesting-{tag}-third-run'
217               <<: *xtesting-jobs
218             - name: 'xtesting-opnfv-xtesting-{tag}-fourth-run'
219               <<: *xtesting-jobs
220             - name: 'xtesting-opnfv-xtesting-{tag}-fifth-run'
221               <<: *xtesting-jobs
222
223 - job-template:
224     name: 'xtesting-{repo}-{container}-{tag}-gate'
225     parameters:
226       - xtesting-slave
227     scm:
228       - xtesting-scm:
229           ref: $GERRIT_REFSPEC
230     builders:
231       - xtesting-build-containers:
232           <<: *xtesting-build-containers
233           ref: $GERRIT_REFSPEC
234
235 - job-template:
236     name: 'xtesting-{repo}-{container}-{tag}-check'
237     parameters:
238       - xtesting-slave
239       - xtesting-branch:
240           branch: '{branch}'
241     scm:
242       - xtesting-scm:
243           ref: $branch
244     builders:
245       - xtesting-build-containers:
246           <<: *xtesting-build-containers
247           ref: $branch
248
249 - project:
250     name: 'xtesting-_-alpine-3.9-rmi'
251     repo: _
252     port:
253     container: alpine
254     tag: 3.9
255     jobs:
256       - 'xtesting-{repo}-{container}-{tag}-rmi'
257
258 - project:
259     name: 'xtesting-_-alpine-3.9-pull'
260     repo: _
261     port:
262     container: alpine
263     tag: 3.9
264     jobs:
265       - 'xtesting-{repo}-{container}-{tag}-pull'
266
267 - project:
268     name: xtesting-opnfv-xtesting-{tag}-build
269     <<: *xtesting-params
270     container: xtesting
271     ref_arg: BRANCH
272     path: docker
273     jobs:
274       - 'xtesting-{repo}-{container}-{tag}-gate'
275       - 'xtesting-{repo}-{container}-{tag}-check'
276
277 - job-template:
278     name: 'xtesting-{tag}-check'
279     project-type: multijob
280     parameters:
281       - xtesting-slave
282       - xtesting-branch:
283           branch: '{branch}'
284     properties:
285       - build-blocker:
286           use-build-blocker: true
287           blocking-level: 'NODE'
288           blocking-jobs:
289             - '^xtesting-[a-z]+-(daily|check|gate)$'
290     builders:
291       - multijob:
292           name: remove former images
293           projects:
294             - name: 'xtesting-opnfv-xtesting-{tag}-rmi'
295               <<: *xtesting-jobs
296       - multijob:
297           name: remove dependencies
298           projects:
299             - name: 'xtesting-_-alpine-3.9-rmi'
300               <<: *xtesting-jobs
301       - multijob:
302           name: pull dependencies
303           projects:
304             - name: 'xtesting-_-alpine-3.9-pull'
305               <<: *xtesting-jobs
306       - multijob:
307           name: opnfv/functest-xtesting
308           projects:
309             - name: 'xtesting-opnfv-xtesting-{tag}-check'
310               <<: *xtesting-jobs
311       - multijob:
312           name: opnfv/xtesting:{tag}
313           projects:
314             - name: 'xtesting-opnfv-xtesting-{tag}-first-run'
315               <<: *xtesting-jobs
316             - name: 'xtesting-opnfv-xtesting-{tag}-second-run'
317               <<: *xtesting-jobs
318             - name: 'xtesting-opnfv-xtesting-{tag}-third-run'
319               <<: *xtesting-jobs
320             - name: 'xtesting-opnfv-xtesting-{tag}-fourth-run'
321               <<: *xtesting-jobs
322             - name: 'xtesting-opnfv-xtesting-{tag}-fifth-run'
323               <<: *xtesting-jobs
324
325 - trigger:
326     name: xtesting-patchset-created
327     triggers:
328       - gerrit:
329           server-name: 'gerrit.opnfv.org'
330           trigger-on:
331             - patchset-created-event
332             - comment-added-contains-event:
333                 comment-contains-value: 'recheck'
334             - comment-added-contains-event:
335                 comment-contains-value: 'reverify'
336           projects:
337             - project-compare-type: 'ANT'
338               project-pattern: 'functest-xtesting'
339               branches:
340                 - branch-compare-type: 'ANT'
341                   branch-pattern: '**/{branch}'
342           skip-vote:
343             successful: false
344             failed: false
345             unstable: false
346             notbuilt: false
347
348 - job-template:
349     name: 'xtesting-{tag}-gate'
350     project-type: multijob
351     triggers:
352       - xtesting-patchset-created:
353           branch: '{branch}'
354     parameters:
355       - xtesting-slave
356     properties:
357       - build-blocker:
358           use-build-blocker: true
359           blocking-level: 'NODE'
360           blocking-jobs:
361             - '^xtesting-[a-z]+-(daily|check|gate)$'
362     builders:
363       - multijob:
364           name: remove former images
365           projects:
366             - name: 'xtesting-opnfv-xtesting-{tag}-rmi'
367               <<: *xtesting-jobs
368       - multijob:
369           name: remove dependencies
370           projects:
371             - name: 'xtesting-_-alpine-3.9-rmi'
372               <<: *xtesting-jobs
373       - multijob:
374           name: pull dependencies
375           projects:
376             - name: 'xtesting-_-alpine-3.9-pull'
377               <<: *xtesting-jobs
378       - multijob:
379           name: opnfv/functest-xtesting
380           projects:
381             - name: 'xtesting-opnfv-xtesting-{tag}-gate'
382               <<: *xtesting-jobs
383       - multijob:
384           name: opnfv/xtesting:{tag}
385           projects:
386             - name: 'xtesting-opnfv-xtesting-{tag}-first-run'
387               <<: *xtesting-jobs
388             - name: 'xtesting-opnfv-xtesting-{tag}-second-run'
389               <<: *xtesting-jobs
390             - name: 'xtesting-opnfv-xtesting-{tag}-third-run'
391               <<: *xtesting-jobs
392             - name: 'xtesting-opnfv-xtesting-{tag}-fourth-run'
393               <<: *xtesting-jobs
394             - name: 'xtesting-opnfv-xtesting-{tag}-fifth-run'
395               <<: *xtesting-jobs
396
397 - project:
398     name: 'xtesting'
399     <<: *xtesting-params
400     jobs:
401       - 'xtesting-{tag}-daily'
402       - 'xtesting-{tag}-check'
403       - 'xtesting-{tag}-gate'
404
405 - view:
406     name: xtesting
407     view-type: list
408     columns:
409       - status
410       - weather
411       - job
412       - last-success
413       - last-failure
414       - last-duration
415     regex: ^xtesting-[a-z]+-(daily|check|gate)$