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