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