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