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