Merge "Levarge latest XtestingCI changes"
[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 \
448             software-properties-common gpg -y
449           sudo add-apt-repository -y ppa:deadsnakes/ppa
450           sudo apt-get update && sudo apt-get install python3.8 python3.8-dev \
451             python3.8-distutils \
452             python3.7 python3.7-dev python3.6 python3.6-dev \
453             python python-dev python3-pip enchant -y
454           sudo pip3 install tox tox-pip-version
455
456           tox
457
458 - job-template:
459     name: 'xtesting-{tag}-tox'
460     scm:
461       - xtesting-scm:
462           ref: $GERRIT_REFSPEC
463     triggers:
464       - xtesting-patchset-created:
465           branch: '{branch}'
466     parameters:
467       - xtesting-slave:
468           slave: '{slave}'
469     builders:
470       - xtesting-tox:
471
472 - project:
473     name: xtesting-tox
474     <<: *xtesting-params
475     jobs:
476       - 'xtesting-{tag}-tox'
477
478 - job-template:
479     name: 'xtesting-{repo}-{container}-{tag}-gate'
480     parameters:
481       - xtesting-slave:
482           slave: '{slave}'
483     scm:
484       - xtesting-scm:
485           ref: $GERRIT_REFSPEC
486     builders:
487       - xtesting-build-containers:
488           <<: *xtesting-build-containers
489           ref: $GERRIT_REFSPEC
490           buildargs: '{buildargs}'
491
492 - project:
493     name: xtesting-opnfv-xtesting-{tag}-gate
494     <<: *xtesting-params
495     container: xtesting
496     ref_arg: BRANCH
497     path: docker/core
498     jobs:
499       - 'xtesting-{repo}-{container}-{tag}-gate'
500
501 - project:
502     name: xtesting-opnfv-xtesting-mts-{tag}-gate
503     <<: *xtesting-params
504     container: xtesting-mts
505     ref_arg: BRANCH
506     path: docker/mts
507     jobs:
508       - 'xtesting-{repo}-{container}-{tag}-gate'
509
510
511 - trigger:
512     name: xtesting-patchset-created
513     triggers:
514       - gerrit:
515           trigger-on:
516             - patchset-created-event
517             - comment-added-contains-event:
518                 comment-contains-value: 'recheck'
519             - comment-added-contains-event:
520                 comment-contains-value: 'reverify'
521           projects:
522             - project-compare-type: 'ANT'
523               project-pattern: 'functest-xtesting'
524               branches:
525                 - branch-compare-type: 'ANT'
526                   branch-pattern: '**/{branch}'
527
528 - job-template:
529     name: 'xtesting-{tag}-review'
530     project-type: multijob
531     triggers:
532       - xtesting-patchset-created:
533           branch: '{branch}'
534     parameters:
535       - xtesting-slave:
536           slave: '{slave}'
537       - xtesting-build_tag:
538           build_tag: ''
539     properties:
540       - build-blocker:
541           use-build-blocker: true
542           blocking-level: 'NODE'
543           blocking-jobs:
544             - '^xtesting-{tag}-(daily|docker|review)$'
545     builders:
546       - multijob:
547           name: remove former images
548           projects:
549             - name: 'xtesting-opnfv-xtesting-{tag}-rmi'
550               <<: *xtesting-jobs
551             - name: 'xtesting-opnfv-xtesting-mts-{tag}-rmi'
552               <<: *xtesting-jobs
553       - multijob:
554           name: remove dependency
555           projects:
556             - name: 'xtesting-{repo}-{tag}-dep-rmi'
557               <<: *xtesting-jobs
558       - multijob:
559           name: pull dependency
560           projects:
561             - name: 'xtesting-{repo}-{tag}-dep-pull'
562               <<: *xtesting-jobs
563       - multijob:
564           name: opnfv/xtesting
565           projects:
566             - name: 'xtesting-opnfv-xtesting-{tag}-gate'
567               <<: *xtesting-jobs
568       - multijob:
569           name: opnfv/xtesting-mts
570           projects:
571             - name: 'xtesting-opnfv-xtesting-mts-{tag}-gate'
572               <<: *xtesting-jobs
573       - multijob:
574           name: opnfv/xtesting:{tag}
575           projects:
576             - name: 'xtesting-opnfv-xtesting-{tag}-first-run'
577               <<: *xtesting-jobs
578             - name: 'xtesting-opnfv-xtesting-{tag}-second-run'
579               <<: *xtesting-jobs
580             - name: 'xtesting-opnfv-xtesting-{tag}-third-run'
581               <<: *xtesting-jobs
582             - name: 'xtesting-opnfv-xtesting-{tag}-fourth-run'
583               <<: *xtesting-jobs
584             - name: 'xtesting-opnfv-xtesting-{tag}-fifth-run'
585               <<: *xtesting-jobs
586             - name: 'xtesting-opnfv-xtesting-{tag}-sixth-run'
587               <<: *xtesting-jobs
588       - multijob:
589           name: opnfv/xtesting-mts:{tag}
590           projects:
591             - name: 'xtesting-opnfv-xtesting-mts-{tag}-seventh-run'
592               <<: *xtesting-jobs
593
594 - project:
595     name: 'xtesting-review'
596     <<: *xtesting-params
597     jobs:
598       - 'xtesting-{tag}-review'
599
600 - view:
601     name: xtesting-review
602     view-type: list
603     columns:
604       - status
605       - weather
606       - job
607       - last-success
608       - last-failure
609       - last-duration
610     regex: ^xtesting-[a-z0-9.]+-review$
611
612 - view:
613     name: xtesting-tox
614     view-type: list
615     columns:
616       - status
617       - weather
618       - job
619       - last-success
620       - last-failure
621       - last-duration
622     regex: ^xtesting-[a-z0-9.]+-tox$
623
624 - builder:
625     name: xtesting-push-containers
626     builders:
627       - shell: |
628           set +x
629           if [ "{repo}" = "_" ]; then
630             image={container}:{tag}
631           elif [ "{port}" = "None" ]; then
632             image={repo}/{container}:{tag}
633           else
634             image={repo}:{port}/{container}:{tag}
635           fi
636           sudo docker push $image
637
638 - trigger:
639     name: xtesting-commit
640     triggers:
641       - pollscm:
642           cron: "*/30 * * * *"
643
644 - job-template:
645     name: 'xtesting-{repo}-{container}-{tag}-build'
646     parameters:
647       - xtesting-slave:
648           slave: '{slave}'
649     scm:
650       - xtesting-scm:
651           ref: '{branch}'
652     builders:
653       - xtesting-build-containers:
654           <<: *xtesting-build-containers
655           ref: '{branch}'
656           buildargs: '{buildargs}'
657       - xtesting-push-containers:
658           <<: *xtesting-build-containers
659           ref: '{branch}'
660
661 - project:
662     name: xtesting-opnfv-xtesting-{tag}-build
663     <<: *xtesting-params
664     container: xtesting
665     ref_arg: BRANCH
666     path: docker/core
667     jobs:
668       - 'xtesting-{repo}-{container}-{tag}-build'
669
670 - project:
671     name: xtesting-opnfv-xtesting-mts-{tag}-build
672     <<: *xtesting-params
673     container: xtesting-mts
674     ref_arg: BRANCH
675     path: docker/mts
676     jobs:
677       - 'xtesting-{repo}-{container}-{tag}-build'
678
679
680 - job-template:
681     name: 'xtesting-{tag}-docker'
682     project-type: multijob
683     triggers:
684       - xtesting-commit
685     scm:
686       - xtesting-scm:
687           ref: '{branch}'
688     parameters:
689       - xtesting-slave:
690           slave: '{slave}'
691     properties:
692       - build-blocker:
693           use-build-blocker: true
694           blocking-level: 'NODE'
695           blocking-jobs:
696             - '^xtesting-{tag}-(daily|docker|review)$'
697     builders:
698       - multijob:
699           name: remove dependency
700           projects:
701             - name: 'xtesting-{repo}-{tag}-dep-rmi'
702               <<: *xtesting-jobs
703       - multijob:
704           name: pull dependency
705           projects:
706             - name: 'xtesting-{repo}-{tag}-dep-pull'
707               <<: *xtesting-jobs
708       - multijob:
709           name: opnfv/xtesting
710           projects:
711             - name: 'xtesting-opnfv-xtesting-{tag}-build'
712               <<: *xtesting-jobs
713       - multijob:
714           name: opnfv/xtesting-mts
715           projects:
716             - name: 'xtesting-opnfv-xtesting-mts-{tag}-build'
717               <<: *xtesting-jobs
718
719 - builder:
720     name: xtesting-trivy
721     builders:
722       - shell: |
723           sudo apt-get update && sudo apt-get install curl -y
724
725           curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sudo sh -s -- -b .
726           if [ "{repo}" = "_" ]; then
727             image={container}:{tag}
728           elif [ "{port}" = "None" ]; then
729             image={repo}/{container}:{tag}
730           else
731             image={repo}:{port}/{container}:{tag}
732           fi
733           ./trivy --exit-code 1 $image
734
735 - job-template:
736     name: 'xtesting-{repo}-{container}-{tag}-trivy'
737     triggers:
738       - timed: '@daily'
739     parameters:
740       - xtesting-slave:
741           slave: '{slave}'
742     builders:
743       - xtesting-trivy:
744           <<: *xtesting-containers
745
746 - project:
747     name: 'xtesting-opnfv-xtesting-trivy'
748     <<: *xtesting-params
749     container: 'xtesting'
750     jobs:
751       - 'xtesting-{repo}-{container}-{tag}-trivy'
752
753 - project:
754     name: 'xtesting-opnfv-xtesting-mts-trivy'
755     <<: *xtesting-params
756     container: 'xtesting-mts'
757     jobs:
758       - 'xtesting-{repo}-{container}-{tag}-trivy'
759
760 - project:
761     name: 'xtesting'
762     <<: *xtesting-params
763     jobs:
764       - 'xtesting-{tag}-docker'
765
766 - view:
767     name: xtesting-docker
768     view-type: list
769     columns:
770       - status
771       - weather
772       - job
773       - last-success
774       - last-failure
775       - last-duration
776     regex: ^xtesting-[a-z0-9.]+-docker$
777
778 - view:
779     name: xtesting-trivy
780     view-type: list
781     columns:
782       - status
783       - weather
784       - job
785       - last-success
786       - last-failure
787       - last-duration
788     regex: (?!xtesting-pi)^xtesting-[a-z-0-9.]+-trivy$