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