3b3ffa7b92743a4901fb2edfa046f77a4b5e63b0
[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|*kali|*jerma)
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     jobs:
192       - 'xtesting-{repo}-{container}-{tag}-pull'
193
194 - job-template:
195     name: 'xtesting-{repo}-{container}-{tag}-rmi'
196     parameters:
197       - xtesting-slave:
198           slave: '{slave}'
199     builders:
200       - xtesting-remove-images:
201           <<: *xtesting-containers
202
203 - project:
204     name: 'xtesting-opnfv-xtesting-rmi'
205     <<: *xtesting-params
206     container: 'xtesting'
207     jobs:
208       - 'xtesting-{repo}-{container}-{tag}-rmi'
209
210 - project:
211     name: 'xtesting-opnfv-xtesting-mts-rmi'
212     <<: *xtesting-params
213     container: 'xtesting-mts'
214     exclude:
215       - tag: hunter
216       - tag: iruya
217     jobs:
218       - 'xtesting-{repo}-{container}-{tag}-rmi'
219
220 - job-template:
221     name: 'xtesting-{repo}-{container}-{tag}-{test}-run'
222     parameters:
223       - xtesting-slave:
224           slave: '{slave}'
225       - xtesting-build_tag:
226           build_tag: ''
227       - xtesting-DEBUG:
228           DEBUG: 'true'
229     builders:
230       - xtesting-run-containers:
231           <<: *xtesting-run-containers
232
233 - project:
234     name: 'xtesting-opnfv-xtesting'
235     <<: *xtesting-params
236     container: 'xtesting'
237     test:
238       - first
239       - second
240       - third
241       - fourth
242       - fifth
243       - sixth
244     privileged: 'false'
245     network: bridge
246     exclude:
247       - {'tag': 'hunter', 'test': 'sixth'}
248       - {'tag': 'iruya', 'test': 'sixth'}
249     jobs:
250       - 'xtesting-{repo}-{container}-{tag}-{test}-run'
251
252 - project:
253     name: 'xtesting-opnfv-xtesting-mts'
254     <<: *xtesting-params
255     container: 'xtesting-mts'
256     test:
257       - seventh
258     privileged: 'false'
259     network: bridge
260     exclude:
261       - {'tag': 'hunter', 'test': 'seventh'}
262       - {'tag': 'iruya', 'test': 'seventh'}
263     jobs:
264       - 'xtesting-{repo}-{container}-{tag}-{test}-run'
265
266
267 - builder:
268     name: xtesting-zip
269     builders:
270       - shell: |
271           set +x
272           if [ "{repo}" = "_" ]; then
273             image={container}:{tag}
274           elif [ "{port}" = "None" ]; then
275             image={repo}/{container}:{tag}
276           else
277             image={repo}:{port}/{container}:{tag}
278           fi
279           sudo docker run --rm \
280             -e S3_ENDPOINT_URL=https://storage.googleapis.com \
281             -e S3_DST_URL=s3://artifacts.opnfv.org/xtesting \
282             -e HTTP_DST_URL=http://artifacts.opnfv.org/xtesting \
283             -v /home/opnfv/xtesting/.boto:/root/.boto \
284             -e TEST_DB_URL=http://testresults.opnfv.org/test/api/v1/results \
285             -e TEST_DB_EXT_URL=http://testresults.opnfv.org/test/api/v1/results \
286             -e BUILD_TAG=$BUILD_TAG \
287             -v $WORKSPACE/../$JOB_NAME/results:/var/lib/xtesting/results \
288             -e DEBUG=$DEBUG \
289             $image zip_campaign
290
291 - job-template:
292     name: 'xtesting-{tag}-zip'
293     parameters:
294       - xtesting-slave:
295           slave: '{slave}'
296       - xtesting-build_tag:
297           build_tag: ''
298       - xtesting-DEBUG:
299           DEBUG: 'true'
300     builders:
301       - xtesting-zip:
302           <<: *xtesting-containers
303
304 - project:
305     name: 'xtesting-{tag}-zip'
306     <<: *xtesting-params
307     container: 'xtesting'
308     jobs:
309       - 'xtesting-{tag}-zip'
310
311 - job-template:
312     name: 'xtesting-{tag}-daily'
313     project-type: multijob
314     triggers:
315       - timed: '@daily'
316     parameters:
317       - xtesting-slave:
318           slave: '{slave}'
319       - xtesting-build_tag:
320           build_tag: ''
321       - xtesting-DEBUG:
322           DEBUG: 'true'
323     properties:
324       - build-blocker:
325           use-build-blocker: true
326           blocking-level: 'NODE'
327           blocking-jobs:
328             - '^xtesting-{tag}-(daily|review)$'
329     builders:
330       - multijob:
331           name: remove former images
332           projects:
333             - name: 'xtesting-opnfv-xtesting-{tag}-rmi'
334               <<: *xtesting-jobs
335             - name: 'xtesting-opnfv-xtesting-mts-{tag}-rmi'
336               <<: *xtesting-jobs
337       - multijob:
338           name: pull containers
339           projects:
340             - name: 'xtesting-opnfv-xtesting-{tag}-pull'
341               <<: *xtesting-jobs
342             - name: 'xtesting-opnfv-xtesting-mts-{tag}-pull'
343               <<: *xtesting-jobs
344       - multijob:
345           name: opnfv/xtesting:{tag}
346           projects:
347             - name: 'xtesting-opnfv-xtesting-{tag}-first-run'
348               <<: *xtesting-jobs
349             - name: 'xtesting-opnfv-xtesting-{tag}-second-run'
350               <<: *xtesting-jobs
351             - name: 'xtesting-opnfv-xtesting-{tag}-third-run'
352               <<: *xtesting-jobs
353             - name: 'xtesting-opnfv-xtesting-{tag}-fourth-run'
354               <<: *xtesting-jobs
355             - name: 'xtesting-opnfv-xtesting-{tag}-fifth-run'
356               <<: *xtesting-jobs
357             - name: 'xtesting-opnfv-xtesting-{tag}-sixth-run'
358               <<: *xtesting-jobs
359       - multijob:
360           name: opnfv/xtesting-mts:{tag}
361           projects:
362             - name: 'xtesting-opnfv-xtesting-mts-{tag}-seventh-run'
363               <<: *xtesting-jobs
364       - multijob:
365           name: dump all campaign data
366           projects:
367             - name: 'xtesting-{tag}-zip'
368               <<: *xtesting-jobs
369
370 - xtesting-dep: &xtesting-dep
371     name: 'xtesting-containers'
372     repo: '{repo}'
373     port: '{port}'
374     tag: '{tag}'
375     dependency: '{dependency}'
376
377 - builder:
378     name: xtesting-pull-dep-images
379     builders:
380       - shell: |
381           set +x
382           if [ "_" = "_" ]; then
383             image=alpine:{dependency}
384           elif [ "_" = "None" ]; then
385             image=_/alpine:{dependency}
386           else
387             image=_:/alpine{dependency}
388           fi
389           sudo docker pull $image || true
390
391 - builder:
392     name: xtesting-remove-dep-images
393     builders:
394       - shell: |
395           set +x
396           if [ "_" = "_" ]; then
397             image=alpine:{dependency}
398           elif [ "_" = "None" ]; then
399             image=_/alpine:{dependency}
400           else
401             image=_:/alpine{dependency}
402           fi
403           sudo docker rmi $image || true
404
405 - job-template:
406     name: 'xtesting-{repo}-{tag}-dep-pull'
407     parameters:
408       - xtesting-slave:
409           slave: '{slave}'
410     builders:
411       - xtesting-pull-dep-images:
412           <<: *xtesting-dep
413
414 - project:
415     name: 'xtesting-{repo}-{tag}-dep-pull'
416     <<: *xtesting-params
417     jobs:
418       - 'xtesting-{repo}-{tag}-dep-pull'
419
420 - job-template:
421     name: 'xtesting-{repo}-{tag}-dep-rmi'
422     parameters:
423       - xtesting-slave:
424           slave: '{slave}'
425     builders:
426       - xtesting-remove-dep-images:
427           <<: *xtesting-dep
428
429 - project:
430     name: 'xtesting-{repo}-{tag}-dep-rmi'
431     <<: *xtesting-params
432     jobs:
433       - 'xtesting-{repo}-{tag}-dep-rmi'
434
435 - builder:
436     name: xtesting-tox
437     builders:
438       - shell: tox
439
440 - job-template:
441     name: 'xtesting-{tag}-tox'
442     scm:
443       - xtesting-scm:
444           ref: $GERRIT_REFSPEC
445     triggers:
446       - xtesting-patchset-created:
447           branch: '{branch}'
448     parameters:
449       - xtesting-slave:
450           slave: '{slave}'
451     builders:
452       - xtesting-tox:
453
454 - project:
455     name: xtesting-tox
456     <<: *xtesting-params
457     jobs:
458       - 'xtesting-{tag}-tox'
459
460 - project:
461     name: xtesting-opnfv-xtesting-{tag}-gate
462     <<: *xtesting-params
463     container: xtesting
464     ref_arg: BRANCH
465     path: docker/core
466     jobs:
467       - 'xtesting-{repo}-{container}-{tag}-gate'
468
469 - project:
470     name: xtesting-opnfv-xtesting-mts-{tag}-gate
471     <<: *xtesting-params
472     container: xtesting-mts
473     ref_arg: BRANCH
474     path: docker/mts
475     exclude:
476       - tag: hunter
477       - tag: iruya
478     jobs:
479       - 'xtesting-{repo}-{container}-{tag}-gate'
480
481
482 - job-template:
483     name: 'xtesting-{repo}-{container}-{tag}-gate'
484     parameters:
485       - xtesting-slave:
486           slave: '{slave}'
487     scm:
488       - xtesting-scm:
489           ref: $GERRIT_REFSPEC
490     builders:
491       - xtesting-build-containers:
492           <<: *xtesting-build-containers
493           ref: $GERRIT_REFSPEC
494
495 - trigger:
496     name: xtesting-patchset-created
497     triggers:
498       - gerrit:
499           trigger-on:
500             - patchset-created-event
501             - comment-added-contains-event:
502                 comment-contains-value: 'recheck'
503             - comment-added-contains-event:
504                 comment-contains-value: 'reverify'
505           projects:
506             - project-compare-type: 'ANT'
507               project-pattern: 'functest-xtesting'
508               branches:
509                 - branch-compare-type: 'ANT'
510                   branch-pattern: '**/{branch}'
511
512 - job-template:
513     name: 'xtesting-{tag}-review'
514     project-type: multijob
515     triggers:
516       - xtesting-patchset-created:
517           branch: '{branch}'
518     parameters:
519       - xtesting-slave:
520           slave: '{slave}'
521       - xtesting-build_tag:
522           build_tag: ''
523       - xtesting-DEBUG:
524           DEBUG: 'true'
525     properties:
526       - build-blocker:
527           use-build-blocker: true
528           blocking-level: 'NODE'
529           blocking-jobs:
530             - '^xtesting-{tag}-(daily|review)$'
531     builders:
532       - multijob:
533           name: remove former images
534           projects:
535             - name: 'xtesting-opnfv-xtesting-{tag}-rmi'
536               <<: *xtesting-jobs
537             - name: 'xtesting-opnfv-xtesting-mts-{tag}-rmi'
538               <<: *xtesting-jobs
539       - multijob:
540           name: remove dependency
541           projects:
542             - name: 'xtesting-{repo}-{tag}-dep-rmi'
543               <<: *xtesting-jobs
544       - multijob:
545           name: pull dependency
546           projects:
547             - name: 'xtesting-{repo}-{tag}-dep-pull'
548               <<: *xtesting-jobs
549       - multijob:
550           name: opnfv/xtesting
551           projects:
552             - name: 'xtesting-opnfv-xtesting-{tag}-gate'
553               <<: *xtesting-jobs
554       - multijob:
555           name: opnfv/xtesting-mts
556           projects:
557             - name: 'xtesting-opnfv-xtesting-mts-{tag}-gate'
558               <<: *xtesting-jobs
559       - multijob:
560           name: opnfv/xtesting:{tag}
561           projects:
562             - name: 'xtesting-opnfv-xtesting-{tag}-first-run'
563               <<: *xtesting-jobs
564             - name: 'xtesting-opnfv-xtesting-{tag}-second-run'
565               <<: *xtesting-jobs
566             - name: 'xtesting-opnfv-xtesting-{tag}-third-run'
567               <<: *xtesting-jobs
568             - name: 'xtesting-opnfv-xtesting-{tag}-fourth-run'
569               <<: *xtesting-jobs
570             - name: 'xtesting-opnfv-xtesting-{tag}-fifth-run'
571               <<: *xtesting-jobs
572             - name: 'xtesting-opnfv-xtesting-{tag}-sixth-run'
573               <<: *xtesting-jobs
574       - multijob:
575           name: opnfv/xtesting-mts:{tag}
576           projects:
577             - name: 'xtesting-opnfv-xtesting-mts-{tag}-seventh-run'
578               <<: *xtesting-jobs
579
580 - trigger:
581     name: xtesting-commit
582     triggers:
583       - pollscm:
584           cron: "*/30 * * * *"
585 - job-template:
586     name: 'xtesting-{repo}-{container}-{tag}-build'
587     parameters:
588       - xtesting-slave:
589           slave: '{slave}'
590     scm:
591       - xtesting-scm:
592           ref: '{branch}'
593     builders:
594       - xtesting-build-containers:
595           <<: *xtesting-build-containers
596           ref: '{branch}'
597
598 - project:
599     name: xtesting-opnfv-xtesting-{tag}-build
600     <<: *xtesting-params
601     container: xtesting
602     ref_arg: BRANCH
603     path: docker/core
604     jobs:
605       - 'xtesting-{repo}-{container}-{tag}-build'
606
607 - project:
608     name: xtesting-opnfv-xtesting-mts-{tag}-build
609     <<: *xtesting-params
610     container: xtesting-mts
611     ref_arg: BRANCH
612     path: docker/mts
613     exclude:
614       - tag: hunter
615       - tag: iruya
616     jobs:
617       - 'xtesting-{repo}-{container}-{tag}-build'
618
619
620 - job-template:
621     name: 'xtesting-{tag}-docker'
622     project-type: multijob
623     triggers:
624       - xtesting-commit
625     scm:
626       - xtesting-scm:
627           ref: '{branch}'
628     parameters:
629       - xtesting-slave:
630           slave: '{slave}'
631       - xtesting-DEBUG:
632           DEBUG: 'true'
633     builders:
634       - multijob:
635           name: remove dependency
636           projects:
637             - name: 'xtesting-{repo}-{tag}-dep-rmi'
638               <<: *xtesting-jobs
639       - multijob:
640           name: pull dependency
641           projects:
642             - name: 'xtesting-{repo}-{tag}-dep-pull'
643               <<: *xtesting-jobs
644       - multijob:
645           name: opnfv/xtesting
646           projects:
647             - name: 'xtesting-opnfv-xtesting-{tag}-build'
648               <<: *xtesting-jobs
649       - multijob:
650           name: opnfv/xtesting-mts
651           projects:
652             - name: 'xtesting-opnfv-xtesting-mts-{tag}-build'
653               <<: *xtesting-jobs
654
655 - builder:
656     name: xtesting-trivy
657     builders:
658       - shell: |
659           curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sudo sh -s -- -b .
660           if [ "{repo}" = "_" ]; then
661             image={container}:{tag}
662           elif [ "{port}" = "None" ]; then
663             image={repo}/{container}:{tag}
664           else
665             image={repo}:{port}/{container}:{tag}
666           fi
667           ./trivy --exit-code 1 $image
668
669 - job-template:
670     name: 'xtesting-{repo}-{container}-{tag}-trivy'
671     parameters:
672       - xtesting-slave:
673           slave: '{slave}'
674     builders:
675       - xtesting-trivy:
676           <<: *xtesting-containers
677
678 - project:
679     name: 'xtesting-opnfv-xtesting-trivy'
680     <<: *xtesting-params
681     container: 'xtesting'
682     jobs:
683       - 'xtesting-{repo}-{container}-{tag}-trivy'
684
685 - project:
686     name: 'xtesting-opnfv-xtesting-mts-trivy'
687     <<: *xtesting-params
688     container: 'xtesting-mts'
689     exclude:
690       - tag: hunter
691       - tag: iruya
692     jobs:
693       - 'xtesting-{repo}-{container}-{tag}-trivy'
694
695 - project:
696     name: 'xtesting'
697     <<: *xtesting-params
698     jobs:
699       - 'xtesting-{tag}-daily'
700       - 'xtesting-{tag}-review'
701       - 'xtesting-{tag}-docker'
702
703
704 - view:
705     name: xtesting-daily
706     view-type: list
707     columns:
708       - status
709       - weather
710       - job
711       - last-success
712       - last-failure
713       - last-duration
714     regex: ^xtesting-[a-z-]+-daily$
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-z-]+-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-z-]+-tox$
739
740 - view:
741     name: xtesting-docker
742     view-type: list
743     columns:
744       - status
745       - weather
746       - job
747       - last-success
748       - last-failure
749       - last-duration
750     regex: ^xtesting-[a-z-]+-docker$
751
752 - view:
753     name: xtesting-trivy
754     view-type: list
755     columns:
756       - status
757       - weather
758       - job
759       - last-success
760       - last-failure
761       - last-duration
762     regex: ^xtesting-[a-z-]+-trivy$