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