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