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