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