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