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