451b870067a9a6b8276a8ed937f916574e32ddd8
[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           dependency: 3.13
15       - leguer:
16           branch: stable/leguer
17           slave: lf-virtual1
18           dependency: 3.12
19       - kali:
20           branch: stable/kali
21           slave: lf-virtual1
22           dependency: 3.11
23       - jerma:
24           branch: stable/jerma
25           slave: lf-virtual1
26           dependency: 3.10
27       - iruya:
28           branch: stable/iruya
29           slave: lf-virtual1
30           dependency: 3.9
31       - hunter:
32           branch: stable/hunter
33           slave: lf-virtual1
34           dependency: 3.9
35
36 - parameter:
37     name: xtesting-slave
38     parameters:
39       - label:
40           name: slave
41           default: '{slave}'
42
43 - parameter:
44     name: xtesting-build_tag
45     parameters:
46       - random-string:
47           name: build_tag
48
49 - parameter:
50     name: xtesting-DEBUG
51     parameters:
52       - string:
53           name: DEBUG
54           default: 'true'
55
56 - xtesting-containers: &xtesting-containers
57     name: 'xtesting-containers'
58     repo: '{repo}'
59     port: '{port}'
60     container: '{container}'
61     tag: '{tag}'
62
63 - xtesting-run-containers: &xtesting-run-containers
64     name: 'xtesting-run-containers'
65     <<: *xtesting-containers
66     test: '{test}'
67     privileged: '{privileged}'
68     network: '{network}'
69
70 - builder:
71     name: xtesting-pull-containers
72     builders:
73       - shell: |
74           set +x
75           if [ "{repo}" = "_" ]; then
76             image={container}:{tag}
77           elif [ "{port}" = "None" ]; then
78             image={repo}/{container}:{tag}
79           else
80             image={repo}:{port}/{container}:{tag}
81           fi
82           sudo docker pull $image
83
84 - builder:
85     name: xtesting-run-containers
86     builders:
87       - shell: |
88           set +x
89           [ ! -z "$WORKSPACE" ] && sudo rm -rf $WORKSPACE/results || true
90           if [ "{repo}" = "_" ]; then
91             image={container}:{tag}
92           elif [ "{port}" = "None" ]; then
93             image={repo}/{container}:{tag}
94           else
95             image={repo}:{port}/{container}:{tag}
96           fi
97           sudo docker run --rm \
98             --privileged={privileged} \
99             --network={network} \
100             -e S3_ENDPOINT_URL=https://storage.googleapis.com \
101             -e S3_DST_URL=s3://artifacts.opnfv.org/xtesting/$BUILD_TAG/$JOB_NAME-$BUILD_ID \
102             -e HTTP_DST_URL=http://artifacts.opnfv.org/xtesting/$BUILD_TAG/$JOB_NAME-$BUILD_ID \
103             -v /home/opnfv/xtesting/.boto:/root/.boto \
104             -e TEST_DB_URL=http://testresults.opnfv.org/test/api/v1/results \
105             -e TEST_DB_EXT_URL=http://testresults.opnfv.org/test/api/v1/results \
106             -e NODE_NAME=$slave \
107             -e BUILD_TAG=$BUILD_TAG \
108             -v $WORKSPACE/../$JOB_NAME/results:/var/lib/xtesting/results \
109             -e DEBUG=$DEBUG \
110             $image run_tests -t {test} -p -r
111
112 - builder:
113     name: xtesting-remove-images
114     builders:
115       - shell: |
116           set +x
117           if [ "{repo}" = "_" ]; then
118             image={container}:{tag}
119           elif [ "{port}" = "None" ]; then
120             image={repo}/{container}:{tag}
121           else
122             image={repo}:{port}/{container}:{tag}
123           fi
124           sudo docker rmi $image || true
125
126 - xtesting-build-containers: &xtesting-build-containers
127     name: 'xtesting-build-containers'
128     <<: *xtesting-containers
129     ref_arg: '{ref_arg}'
130     path: '{path}'
131
132 - builder:
133     name: xtesting-build-containers
134     builders:
135       - shell: |
136           set +x
137           if [ "{repo}" = "_" ]; then
138             image={container}:{tag}
139           elif [ "{port}" = "None" ]; then
140             image={repo}/{container}:{tag}
141           else
142             image={repo}:{port}/{container}:{tag}
143           fi
144           if [ "{ref_arg}" = "None" ]; then
145             build_arg=""
146           else
147             build_arg="--build-arg {ref_arg}={ref}"
148           fi
149           cd {path};;
150           sudo docker build $build_arg \
151             --pull=false --no-cache --force-rm=true \
152             -t $image .
153
154 - scm:
155     name: xtesting-scm
156     scm:
157       - git:
158           url: 'https://gerrit.opnfv.org/gerrit/functest-xtesting'
159           refspec: '+refs/heads/*:refs/remotes/origin/* +refs/changes/*:refs/changes/*'
160           branches:
161             - '{ref}'
162
163 - job-template:
164     name: 'xtesting-{repo}-{container}-{tag}-pull'
165     parameters:
166       - xtesting-slave:
167           slave: '{slave}'
168     builders:
169       - xtesting-pull-containers:
170           <<: *xtesting-containers
171
172 - project:
173     name: 'xtesting-opnfv-xtesting-pull'
174     <<: *xtesting-params
175     container: 'xtesting'
176     jobs:
177       - 'xtesting-{repo}-{container}-{tag}-pull'
178
179 - project:
180     name: 'xtesting-opnfv-xtesting-mts-pull'
181     <<: *xtesting-params
182     container: 'xtesting-mts'
183     jobs:
184       - 'xtesting-{repo}-{container}-{tag}-pull'
185
186 - job-template:
187     name: 'xtesting-{repo}-{container}-{tag}-rmi'
188     parameters:
189       - xtesting-slave:
190           slave: '{slave}'
191     builders:
192       - xtesting-remove-images:
193           <<: *xtesting-containers
194
195 - project:
196     name: 'xtesting-opnfv-xtesting-rmi'
197     <<: *xtesting-params
198     container: 'xtesting'
199     jobs:
200       - 'xtesting-{repo}-{container}-{tag}-rmi'
201
202 - project:
203     name: 'xtesting-opnfv-xtesting-mts-rmi'
204     <<: *xtesting-params
205     container: 'xtesting-mts'
206     jobs:
207       - 'xtesting-{repo}-{container}-{tag}-rmi'
208
209 - job-template:
210     name: 'xtesting-{repo}-{container}-{tag}-{test}-run'
211     parameters:
212       - xtesting-slave:
213           slave: '{slave}'
214       - xtesting-build_tag:
215           build_tag: ''
216       - xtesting-DEBUG:
217           DEBUG: 'true'
218     builders:
219       - xtesting-run-containers:
220           <<: *xtesting-run-containers
221
222 - project:
223     name: 'xtesting-opnfv-xtesting'
224     <<: *xtesting-params
225     container: 'xtesting'
226     test:
227       - first
228       - second
229       - third
230       - fourth
231       - fifth
232       - sixth
233     privileged: 'false'
234     network: bridge
235     jobs:
236       - 'xtesting-{repo}-{container}-{tag}-{test}-run'
237
238 - project:
239     name: 'xtesting-opnfv-xtesting-mts'
240     <<: *xtesting-params
241     container: 'xtesting-mts'
242     test:
243       - seventh
244     privileged: 'false'
245     network: bridge
246     jobs:
247       - 'xtesting-{repo}-{container}-{tag}-{test}-run'
248
249
250 - builder:
251     name: xtesting-zip
252     builders:
253       - shell: |
254           set +x
255           if [ "{repo}" = "_" ]; then
256             image={container}:{tag}
257           elif [ "{port}" = "None" ]; then
258             image={repo}/{container}:{tag}
259           else
260             image={repo}:{port}/{container}:{tag}
261           fi
262           sudo docker run --rm \
263             -e S3_ENDPOINT_URL=https://storage.googleapis.com \
264             -e S3_DST_URL=s3://artifacts.opnfv.org/xtesting \
265             -e HTTP_DST_URL=http://artifacts.opnfv.org/xtesting \
266             -v /home/opnfv/xtesting/.boto:/root/.boto \
267             -e TEST_DB_URL=http://testresults.opnfv.org/test/api/v1/results \
268             -e TEST_DB_EXT_URL=http://testresults.opnfv.org/test/api/v1/results \
269             -e BUILD_TAG=$BUILD_TAG \
270             -v $WORKSPACE/../$JOB_NAME/results:/var/lib/xtesting/results \
271             -e DEBUG=$DEBUG \
272             $image zip_campaign
273
274 - job-template:
275     name: 'xtesting-{tag}-zip'
276     parameters:
277       - xtesting-slave:
278           slave: '{slave}'
279       - xtesting-build_tag:
280           build_tag: ''
281       - xtesting-DEBUG:
282           DEBUG: 'true'
283     builders:
284       - xtesting-zip:
285           <<: *xtesting-containers
286
287 - project:
288     name: 'xtesting-{tag}-zip'
289     <<: *xtesting-params
290     container: 'xtesting'
291     jobs:
292       - 'xtesting-{tag}-zip'
293
294 - job-template:
295     name: 'xtesting-{tag}-daily'
296     project-type: multijob
297     triggers:
298       - timed: '@daily'
299     parameters:
300       - xtesting-slave:
301           slave: '{slave}'
302       - xtesting-build_tag:
303           build_tag: ''
304       - xtesting-DEBUG:
305           DEBUG: 'true'
306     properties:
307       - build-blocker:
308           use-build-blocker: true
309           blocking-level: 'NODE'
310           blocking-jobs:
311             - '^xtesting-{tag}-(daily|review)$'
312     builders:
313       - multijob:
314           name: remove former images
315           projects:
316             - name: 'xtesting-opnfv-xtesting-{tag}-rmi'
317               <<: *xtesting-jobs
318             - name: 'xtesting-opnfv-xtesting-mts-{tag}-rmi'
319               <<: *xtesting-jobs
320       - multijob:
321           name: pull containers
322           projects:
323             - name: 'xtesting-opnfv-xtesting-{tag}-pull'
324               <<: *xtesting-jobs
325             - name: 'xtesting-opnfv-xtesting-mts-{tag}-pull'
326               <<: *xtesting-jobs
327       - multijob:
328           name: opnfv/xtesting:{tag}
329           projects:
330             - name: 'xtesting-opnfv-xtesting-{tag}-first-run'
331               <<: *xtesting-jobs
332             - name: 'xtesting-opnfv-xtesting-{tag}-second-run'
333               <<: *xtesting-jobs
334             - name: 'xtesting-opnfv-xtesting-{tag}-third-run'
335               <<: *xtesting-jobs
336             - name: 'xtesting-opnfv-xtesting-{tag}-fourth-run'
337               <<: *xtesting-jobs
338             - name: 'xtesting-opnfv-xtesting-{tag}-fifth-run'
339               <<: *xtesting-jobs
340             - name: 'xtesting-opnfv-xtesting-{tag}-sixth-run'
341               <<: *xtesting-jobs
342       - multijob:
343           name: opnfv/xtesting-mts:{tag}
344           projects:
345             - name: 'xtesting-opnfv-xtesting-mts-{tag}-seventh-run'
346               <<: *xtesting-jobs
347       - multijob:
348           name: dump all campaign data
349           projects:
350             - name: 'xtesting-{tag}-zip'
351               <<: *xtesting-jobs
352
353 - xtesting-dep: &xtesting-dep
354     name: 'xtesting-containers'
355     repo: '{repo}'
356     port: '{port}'
357     tag: '{tag}'
358     dependency: '{dependency}'
359
360 - builder:
361     name: xtesting-pull-dep-images
362     builders:
363       - shell: |
364           set +x
365           if [ "_" = "_" ]; then
366             image=alpine:{dependency}
367           elif [ "_" = "None" ]; then
368             image=_/alpine:{dependency}
369           else
370             image=_:/alpine{dependency}
371           fi
372           sudo docker pull $image || true
373
374 - builder:
375     name: xtesting-remove-dep-images
376     builders:
377       - shell: |
378           set +x
379           if [ "_" = "_" ]; then
380             image=alpine:{dependency}
381           elif [ "_" = "None" ]; then
382             image=_/alpine:{dependency}
383           else
384             image=_:/alpine{dependency}
385           fi
386           sudo docker rmi $image || true
387
388 - job-template:
389     name: 'xtesting-{repo}-{tag}-dep-pull'
390     parameters:
391       - xtesting-slave:
392           slave: '{slave}'
393     builders:
394       - xtesting-pull-dep-images:
395           <<: *xtesting-dep
396
397 - project:
398     name: 'xtesting-{repo}-{tag}-dep-pull'
399     <<: *xtesting-params
400     jobs:
401       - 'xtesting-{repo}-{tag}-dep-pull'
402
403 - job-template:
404     name: 'xtesting-{repo}-{tag}-dep-rmi'
405     parameters:
406       - xtesting-slave:
407           slave: '{slave}'
408     builders:
409       - xtesting-remove-dep-images:
410           <<: *xtesting-dep
411
412 - project:
413     name: 'xtesting-{repo}-{tag}-dep-rmi'
414     <<: *xtesting-params
415     jobs:
416       - 'xtesting-{repo}-{tag}-dep-rmi'
417
418 - builder:
419     name: xtesting-tox
420     builders:
421       - shell: tox
422
423 - job-template:
424     name: 'xtesting-{tag}-tox'
425     scm:
426       - xtesting-scm:
427           ref: $GERRIT_REFSPEC
428     triggers:
429       - xtesting-patchset-created:
430           branch: '{branch}'
431     parameters:
432       - xtesting-slave:
433           slave: '{slave}'
434     builders:
435       - xtesting-tox:
436
437 - project:
438     name: xtesting-tox
439     <<: *xtesting-params
440     jobs:
441       - 'xtesting-{tag}-tox'
442
443 - project:
444     name: xtesting-opnfv-xtesting-{tag}-gate
445     <<: *xtesting-params
446     container: xtesting
447     ref_arg: BRANCH
448     path: docker/core
449     jobs:
450       - 'xtesting-{repo}-{container}-{tag}-gate'
451
452 - project:
453     name: xtesting-opnfv-xtesting-mts-{tag}-gate
454     <<: *xtesting-params
455     container: xtesting-mts
456     ref_arg: BRANCH
457     path: docker/mts
458     jobs:
459       - 'xtesting-{repo}-{container}-{tag}-gate'
460
461
462 - job-template:
463     name: 'xtesting-{repo}-{container}-{tag}-gate'
464     parameters:
465       - xtesting-slave:
466           slave: '{slave}'
467     scm:
468       - xtesting-scm:
469           ref: $GERRIT_REFSPEC
470     builders:
471       - xtesting-build-containers:
472           <<: *xtesting-build-containers
473           ref: $GERRIT_REFSPEC
474
475 - trigger:
476     name: xtesting-patchset-created
477     triggers:
478       - gerrit:
479           trigger-on:
480             - patchset-created-event
481             - comment-added-contains-event:
482                 comment-contains-value: 'recheck'
483             - comment-added-contains-event:
484                 comment-contains-value: 'reverify'
485           projects:
486             - project-compare-type: 'ANT'
487               project-pattern: 'functest-xtesting'
488               branches:
489                 - branch-compare-type: 'ANT'
490                   branch-pattern: '**/{branch}'
491
492 - job-template:
493     name: 'xtesting-{tag}-review'
494     project-type: multijob
495     triggers:
496       - xtesting-patchset-created:
497           branch: '{branch}'
498     parameters:
499       - xtesting-slave:
500           slave: '{slave}'
501       - xtesting-build_tag:
502           build_tag: ''
503       - xtesting-DEBUG:
504           DEBUG: 'true'
505     properties:
506       - build-blocker:
507           use-build-blocker: true
508           blocking-level: 'NODE'
509           blocking-jobs:
510             - '^xtesting-{tag}-(daily|review)$'
511     builders:
512       - multijob:
513           name: remove former images
514           projects:
515             - name: 'xtesting-opnfv-xtesting-{tag}-rmi'
516               <<: *xtesting-jobs
517             - name: 'xtesting-opnfv-xtesting-mts-{tag}-rmi'
518               <<: *xtesting-jobs
519       - multijob:
520           name: remove dependency
521           projects:
522             - name: 'xtesting-{repo}-{tag}-dep-rmi'
523               <<: *xtesting-jobs
524       - multijob:
525           name: pull dependency
526           projects:
527             - name: 'xtesting-{repo}-{tag}-dep-pull'
528               <<: *xtesting-jobs
529       - multijob:
530           name: opnfv/xtesting
531           projects:
532             - name: 'xtesting-opnfv-xtesting-{tag}-gate'
533               <<: *xtesting-jobs
534       - multijob:
535           name: opnfv/xtesting-mts
536           projects:
537             - name: 'xtesting-opnfv-xtesting-mts-{tag}-gate'
538               <<: *xtesting-jobs
539       - multijob:
540           name: opnfv/xtesting:{tag}
541           projects:
542             - name: 'xtesting-opnfv-xtesting-{tag}-first-run'
543               <<: *xtesting-jobs
544             - name: 'xtesting-opnfv-xtesting-{tag}-second-run'
545               <<: *xtesting-jobs
546             - name: 'xtesting-opnfv-xtesting-{tag}-third-run'
547               <<: *xtesting-jobs
548             - name: 'xtesting-opnfv-xtesting-{tag}-fourth-run'
549               <<: *xtesting-jobs
550             - name: 'xtesting-opnfv-xtesting-{tag}-fifth-run'
551               <<: *xtesting-jobs
552             - name: 'xtesting-opnfv-xtesting-{tag}-sixth-run'
553               <<: *xtesting-jobs
554       - multijob:
555           name: opnfv/xtesting-mts:{tag}
556           projects:
557             - name: 'xtesting-opnfv-xtesting-mts-{tag}-seventh-run'
558               <<: *xtesting-jobs
559
560 - trigger:
561     name: xtesting-commit
562     triggers:
563       - pollscm:
564           cron: "*/30 * * * *"
565 - job-template:
566     name: 'xtesting-{repo}-{container}-{tag}-build'
567     parameters:
568       - xtesting-slave:
569           slave: '{slave}'
570     scm:
571       - xtesting-scm:
572           ref: '{branch}'
573     builders:
574       - xtesting-build-containers:
575           <<: *xtesting-build-containers
576           ref: '{branch}'
577
578 - project:
579     name: xtesting-opnfv-xtesting-{tag}-build
580     <<: *xtesting-params
581     container: xtesting
582     ref_arg: BRANCH
583     path: docker/core
584     jobs:
585       - 'xtesting-{repo}-{container}-{tag}-build'
586
587 - project:
588     name: xtesting-opnfv-xtesting-mts-{tag}-build
589     <<: *xtesting-params
590     container: xtesting-mts
591     ref_arg: BRANCH
592     path: docker/mts
593     jobs:
594       - 'xtesting-{repo}-{container}-{tag}-build'
595
596
597 - job-template:
598     name: 'xtesting-{tag}-docker'
599     project-type: multijob
600     triggers:
601       - xtesting-commit
602     scm:
603       - xtesting-scm:
604           ref: '{branch}'
605     parameters:
606       - xtesting-slave:
607           slave: '{slave}'
608       - xtesting-DEBUG:
609           DEBUG: 'true'
610     builders:
611       - multijob:
612           name: remove dependency
613           projects:
614             - name: 'xtesting-{repo}-{tag}-dep-rmi'
615               <<: *xtesting-jobs
616       - multijob:
617           name: pull dependency
618           projects:
619             - name: 'xtesting-{repo}-{tag}-dep-pull'
620               <<: *xtesting-jobs
621       - multijob:
622           name: opnfv/xtesting
623           projects:
624             - name: 'xtesting-opnfv-xtesting-{tag}-build'
625               <<: *xtesting-jobs
626       - multijob:
627           name: opnfv/xtesting-mts
628           projects:
629             - name: 'xtesting-opnfv-xtesting-mts-{tag}-build'
630               <<: *xtesting-jobs
631
632 - builder:
633     name: xtesting-trivy
634     builders:
635       - shell: |
636           curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sudo sh -s -- -b .
637           if [ "{repo}" = "_" ]; then
638             image={container}:{tag}
639           elif [ "{port}" = "None" ]; then
640             image={repo}/{container}:{tag}
641           else
642             image={repo}:{port}/{container}:{tag}
643           fi
644           ./trivy --exit-code 1 $image
645
646 - job-template:
647     name: 'xtesting-{repo}-{container}-{tag}-trivy'
648     parameters:
649       - xtesting-slave:
650           slave: '{slave}'
651     builders:
652       - xtesting-trivy:
653           <<: *xtesting-containers
654
655 - project:
656     name: 'xtesting-opnfv-xtesting-trivy'
657     <<: *xtesting-params
658     container: 'xtesting'
659     jobs:
660       - 'xtesting-{repo}-{container}-{tag}-trivy'
661
662 - project:
663     name: 'xtesting-opnfv-xtesting-mts-trivy'
664     <<: *xtesting-params
665     container: 'xtesting-mts'
666     jobs:
667       - 'xtesting-{repo}-{container}-{tag}-trivy'
668
669 - project:
670     name: 'xtesting'
671     <<: *xtesting-params
672     jobs:
673       - 'xtesting-{tag}-daily'
674       - 'xtesting-{tag}-review'
675       - 'xtesting-{tag}-docker'
676
677
678 - view:
679     name: xtesting-daily
680     view-type: list
681     columns:
682       - status
683       - weather
684       - job
685       - last-success
686       - last-failure
687       - last-duration
688     regex: ^xtesting-[a-z-]+-daily$
689
690 - view:
691     name: xtesting-review
692     view-type: list
693     columns:
694       - status
695       - weather
696       - job
697       - last-success
698       - last-failure
699       - last-duration
700     regex: ^xtesting-[a-z-]+-review$
701
702 - view:
703     name: xtesting-tox
704     view-type: list
705     columns:
706       - status
707       - weather
708       - job
709       - last-success
710       - last-failure
711       - last-duration
712     regex: ^xtesting-[a-z-]+-tox$
713
714 - view:
715     name: xtesting-docker
716     view-type: list
717     columns:
718       - status
719       - weather
720       - job
721       - last-success
722       - last-failure
723       - last-duration
724     regex: ^xtesting-[a-z-]+-docker$
725
726 - view:
727     name: xtesting-trivy
728     view-type: list
729     columns:
730       - status
731       - weather
732       - job
733       - last-success
734       - last-failure
735       - last-duration
736     regex: ^xtesting-[a-z-]+-trivy$