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