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