Remove user venv from sandbox cleanup script
[releng/global-jjb.git] / jjb / lf-ci-jobs.yaml
1 ---
2 ####################
3 # COMMON FUNCTIONS #
4 ####################
5
6 - builder:
7     name: lf-infra-jjbini
8     builders:
9       - config-file-provider:
10           files:
11             - file-id: jjbini
12               target: "$HOME/.config/jenkins_jobs/jenkins_jobs.ini"
13
14 - lf_packer: &lf_packer_common
15     name: lf-packer-common
16     # Provide configuration common in packer jobs.
17
18     ######################
19     # Default parameters #
20     ######################
21
22     branch: master
23     build-timeout: 90
24     cron: "@monthly"
25     disable-job: false
26     github-url: "https://github.com"
27     stream: master
28     submodule-recursive: true
29     submodule-timeout: 10
30     submodule-disable: false
31     packer-cloud-settings: packer-cloud-env
32     packer-version: 1.4.2
33
34     #####################
35     # Job Configuration #
36     #####################
37
38     project-type: freestyle
39     node: "{build-node}"
40     disabled: "{disable-job}"
41
42     properties:
43       - lf-infra-properties:
44           project: "{project}"
45           build-days-to-keep: 7
46
47     parameters:
48       - lf-infra-parameters:
49           project: "{project}"
50           stream: "{stream}"
51           branch: "{branch}"
52       - lf-packer-parameters:
53           packer-version: "{packer-version}"
54
55     wrappers:
56       - lf-infra-wrappers:
57           build-timeout: "{build-timeout}"
58           jenkins-ssh-credential: "{jenkins-ssh-credential}"
59
60     publishers:
61       - lf-infra-publish
62
63 - parameter:
64     name: lf-infra-jjb-parameters
65     parameters:
66       - string:
67           name: JJB_VERSION
68           default: "{jjb-version}"
69           description: Jenkins Job Builder version to download and install.
70       - string:
71           name: XDG_CACHE_HOME
72           default: "{jjb-cache}"
73           description: Jenkins Job Builder cache location.
74
75 - parameter:
76     name: lf-packer-parameters
77     parameters:
78       - string:
79           name: PACKER_VERSION
80           default: "{packer-version}"
81           description: Packer version to download and install.
82
83 - parameter:
84     name: lf-puppet-parameters
85     parameters:
86       - string:
87           name: PUPPET_LINT_VERSION
88           default: "{puppet-lint-version}"
89           description: Puppet-lint version to download and install.
90
91 - lf_jjb_common: &lf_jjb_common
92     name: lf-jjb-common
93
94     ######################
95     # Default parameters #
96     ######################
97
98     branch: master
99     build-timeout: 10
100     disable-job: false
101     github-url: "https://github.com"
102     jjb-cache: "$HOME/.cache/jenkins_jobs"
103     jjb-version: 2.8.0
104     stream: master
105     submodule-recursive: true
106     submodule-timeout: 10
107     submodule-disable: false
108     throttle_categories: []
109     throttle-enabled: false
110     throttle-max-per-node: 1
111     throttle-max-total: 0
112     throttle-option: "project"
113
114     gerrit_trigger_file_paths:
115       - compare-type: REG_EXP
116         pattern: "jjb/.*"
117       - compare-type: REG_EXP
118         pattern: "global-jjb"
119       - compare-type: REG_EXP
120         pattern: "shell/.*"
121
122     # github_included_regions MUST match gerrit_trigger_file_paths
123     github_included_regions:
124       - "jjb/.*"
125       - "global-jjb"
126       - "shell/.*"
127
128     #####################
129     # Job Configuration #
130     #####################
131
132     project-type: freestyle
133     node: "{build-node}"
134     disabled: "{disable-job}"
135
136     properties:
137       - lf-infra-properties:
138           project: "{project}"
139           build-days-to-keep: 7
140       - throttle:
141           categories: "{obj:throttle_categories}"
142           enabled: "{throttle-enabled}"
143           max-per-node: "{throttle-max-per-node}"
144           max-total: "{throttle-max-total}"
145           option: "{throttle-option}"
146
147     parameters:
148       - lf-infra-parameters:
149           project: "{project}"
150           stream: "{stream}"
151           branch: "{branch}"
152       - lf-infra-jjb-parameters:
153           jjb-cache: "{jjb-cache}"
154           jjb-version: "{jjb-version}"
155
156     wrappers:
157       - lf-infra-wrappers:
158           build-timeout: "{build-timeout}"
159           jenkins-ssh-credential: "{jenkins-ssh-credential}"
160
161     publishers:
162       - lf-infra-publish
163
164 ######################
165 # Gerrit Branch Lock #
166 ######################
167
168 - job-template:
169     name: "{project-name}-gerrit-branch-lock-{stream}"
170     id: gerrit-branch-lock
171
172     ######################
173     # Default parameters #
174     ######################
175
176     branch: master
177     disable-job: false
178     git-url: "$GIT_URL/$GERRIT_PROJECT"
179     stream: master
180     submodule-timeout: 10
181     submodule-disable: false
182     gerrit_merge_triggers:
183       - comment-added-contains-event:
184           comment-contains-value: (un)?lock branch$
185
186     #####################
187     # Job Configuration #
188     #####################
189
190     project-type: freestyle
191     node: "{build-node}"
192     disabled: "{disable-job}"
193
194     properties:
195       - lf-infra-properties:
196           project: "{project}"
197           build-days-to-keep: 1
198
199     parameters:
200       - lf-infra-parameters:
201           project: "{project}"
202           stream: "{stream}"
203           branch: "{branch}"
204
205     wrappers:
206       - lf-infra-wrappers:
207           build-timeout: 5
208           jenkins-ssh-credential: "{jenkins-ssh-credential}"
209
210     scm:
211       - lf-infra-gerrit-scm:
212           git-url: "{git-url}"
213           refspec: ""
214           branch: "{branch}"
215           submodule-recursive: false
216           submodule-timeout: "{submodule-timeout}"
217           submodule-disable: "{submodule-disable}"
218           choosing-strategy: default
219           jenkins-ssh-credential: "{jenkins-ssh-credential}"
220
221     triggers:
222       - gerrit:
223           server-name: "{gerrit-server-name}"
224           trigger-on: "{obj:gerrit_merge_triggers}"
225           projects:
226             - project-compare-type: ANT
227               project-pattern: "{project}"
228               branches:
229                 - branch-compare-type: ANT
230                   branch-pattern: "**/{branch}"
231
232     builders:
233       - shell: !include-raw-escape: ../shell/gerrit-branch-lock.sh
234
235     publishers:
236       - lf-infra-publish
237
238 ##########################################
239 # Jenkins Configuration Management Merge #
240 ##########################################
241
242 - builder:
243     name: lf-jenkins-cfg-clouds
244     builders:
245       - lf-infra-jjbini
246       - inject:
247           properties-content: "jenkins_silos={jenkins-silos}"
248       - shell: !include-raw-escape: ../shell/jenkins-configure-clouds.sh
249       - shell: rm -f "$HOME/.config/jenkins_jobs/jenkins_jobs.ini"
250
251 - builder:
252     name: lf-jenkins-cfg-global-vars
253     builders:
254       - lf-infra-jjbini
255       - inject:
256           properties-content: "jenkins_silos={jenkins-silos}"
257       - shell: !include-raw-escape: ../shell/jenkins-configure-global-vars.sh
258       - shell: rm -f "$HOME/.config/jenkins_jobs/jenkins_jobs.ini"
259
260 - lf_jenkins_configuration: &lf_jenkins_cfg_merge
261     name: lf-jenkins-cfg-merge
262
263     ######################
264     # Default parameters #
265     ######################
266
267     branch: master
268     cron: "@daily"
269     disable-job: false
270     git-url: "$GIT_URL/$GERRIT_PROJECT"
271     github-url: "https://github.com"
272     jenkins-silos: production sandbox
273     submodule-timeout: 10
274     submodule-disable: false
275
276     gerrit_merge_triggers:
277       - change-merged-event
278       - comment-added-contains-event:
279           comment-contains-value: '^Patch Set\s+\d+:\s+remerge\s*$'
280
281     gerrit_trigger_file_paths:
282       - compare-type: REG_EXP
283         pattern: 'jenkins-config\/.*'
284
285     # github_included_regions MUST match gerrit_trigger_file_paths
286     github_included_regions:
287       - 'jenkins-config\/.*'
288
289     #####################
290     # Job Configuration #
291     #####################
292
293     project-type: freestyle
294     node: "{build-node}"
295     concurrent: false
296     disabled: "{disable-job}"
297
298     properties:
299       - lf-infra-properties:
300           project: "{project}"
301           build-days-to-keep: 1
302
303     parameters:
304       - lf-infra-parameters:
305           project: "{project}"
306           stream: ""
307           branch: master
308
309     wrappers:
310       - lf-infra-wrappers:
311           build-timeout: 10
312           jenkins-ssh-credential: "{jenkins-ssh-credential}"
313
314     builders:
315       - lf-infra-pre-build
316       - lf-jenkins-cfg-global-vars:
317           jenkins-silos: "{jenkins-silos}"
318       - lf-jenkins-cfg-clouds:
319           jenkins-silos: "{jenkins-silos}"
320
321     publishers:
322       - lf-infra-publish
323
324 - job-template:
325     name: "{project-name}-jenkins-cfg-merge"
326     id: gerrit-jenkins-cfg-merge
327     <<: *lf_jenkins_cfg_merge
328
329     scm:
330       - lf-infra-gerrit-scm:
331           git-url: "{git-url}"
332           refspec: "refs/heads/{branch}"
333           branch: "{branch}"
334           submodule-recursive: true
335           submodule-timeout: "{submodule-timeout}"
336           submodule-disable: "{submodule-disable}"
337           choosing-strategy: default
338           jenkins-ssh-credential: "{jenkins-ssh-credential}"
339
340     triggers:
341       - timed: "{obj:cron}"
342       - gerrit:
343           server-name: "{gerrit-server-name}"
344           trigger-on: "{obj:gerrit_merge_triggers}"
345           projects:
346             - project-compare-type: ANT
347               project-pattern: "{project}"
348               branches:
349                 - branch-compare-type: ANT
350                   branch-pattern: "**/{branch}"
351               file-paths: "{obj:gerrit_trigger_file_paths}"
352
353 - job-template:
354     name: "{project-name}-jenkins-cfg-merge"
355     id: github-jenkins-cfg-merge
356     <<: *lf_jenkins_cfg_merge
357
358     properties:
359       - lf-infra-properties:
360           project: "{project}"
361           build-days-to-keep: 1
362       - github:
363           url: "{github-url}/{github-org}/{project}"
364
365     scm:
366       - lf-infra-github-scm:
367           url: "{git-clone-url}{github-org}/{project}"
368           refspec: ""
369           branch: "refs/heads/{branch}"
370           submodule-recursive: true
371           submodule-timeout: "{submodule-timeout}"
372           submodule-disable: "{submodule-disable}"
373           choosing-strategy: default
374           jenkins-ssh-credential: "{jenkins-ssh-credential}"
375
376     triggers:
377       - timed: "{obj:cron}"
378       - github
379       - pollscm:
380           cron: ""
381       - github-pull-request:
382           trigger-phrase: "^remerge$"
383           only-trigger-phrase: true
384           status-context: "Jenkins CFG Merge"
385           permit-all: true
386           github-hooks: true
387           org-list:
388             - "{github-org}"
389           white-list: "{obj:github_pr_whitelist}"
390           admin-list: "{obj:github_pr_admin_list}"
391           included-regions: "{obj:github_included_regions}"
392           white-list-target-branches:
393             - "{branch}"
394
395 ###########################################
396 # Jenkins Configuration Management Verify #
397 ###########################################
398
399 - lf_jenkins_configuration: &lf_jenkins_cfg_verify
400     name: lf-jenkins-cfg-verify
401
402     ######################
403     # Default parameters #
404     ######################
405
406     branch: master
407     build-days-to-keep: 7
408     disable-job: false
409     git-url: "$GIT_URL/$GERRIT_PROJECT"
410     github-url: "https://github.com"
411     submodule-timeout: 10
412     submodule-disable: false
413
414     gerrit_verify_triggers:
415       - patchset-created-event:
416           exclude-drafts: true
417           exclude-trivial-rebase: false
418           exclude-no-code-change: false
419       - draft-published-event
420       - comment-added-contains-event:
421           comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
422
423     gerrit_trigger_file_paths:
424       - compare-type: REG_EXP
425         pattern: 'jenkins-config\/.*'
426
427     # github_included_regions MUST match gerrit_trigger_file_paths
428     github_included_regions:
429       - 'jenkins-config\/.*'
430
431     #####################
432     # Job Configuration #
433     #####################
434
435     project-type: freestyle
436     node: "{build-node}"
437     concurrent: true
438     disabled: "{disable-job}"
439
440     properties:
441       - lf-infra-properties:
442           project: "{project}"
443           build-days-to-keep: 1
444
445     parameters:
446       - lf-infra-parameters:
447           project: "{project}"
448           stream: ""
449           branch: master
450
451     wrappers:
452       - lf-infra-wrappers:
453           build-timeout: 10
454           jenkins-ssh-credential: "{jenkins-ssh-credential}"
455       - config-file-provider:
456           # Listed after to override openstack-infra-wrappers clouds.yaml
457           # definition
458           files:
459             - file-id: clouds-yaml
460               target: "$HOME/.config/openstack/clouds.yaml"
461             - file-id: npmrc
462               target: "$HOME/.npmrc"
463             - file-id: pipconf
464               target: "$HOME/.config/pip/pip.conf"
465
466     builders:
467       - lf-infra-pre-build
468       - shell: !include-raw-escape: ../shell/jenkins-verify-images.sh
469
470     publishers:
471       - lf-infra-publish
472
473 - job-template:
474     name: "{project-name}-jenkins-cfg-verify"
475     id: gerrit-jenkins-cfg-verify
476     <<: *lf_jenkins_cfg_verify
477
478     scm:
479       - lf-infra-gerrit-scm:
480           git-url: "{git-url}"
481           refspec: "$GERRIT_REFSPEC"
482           branch: "$GERRIT_BRANCH"
483           submodule-recursive: true
484           submodule-timeout: "{submodule-timeout}"
485           submodule-disable: "{submodule-disable}"
486           choosing-strategy: gerrit
487           jenkins-ssh-credential: "{jenkins-ssh-credential}"
488
489     triggers:
490       - gerrit:
491           server-name: "{gerrit-server-name}"
492           trigger-on: "{obj:gerrit_verify_triggers}"
493           projects:
494             - project-compare-type: ANT
495               project-pattern: "{project}"
496               branches:
497                 - branch-compare-type: ANT
498                   branch-pattern: "**/{branch}"
499               file-paths: "{obj:gerrit_trigger_file_paths}"
500
501 - job-template:
502     name: "{project-name}-jenkins-cfg-verify"
503     id: github-jenkins-cfg-verify
504     <<: *lf_jenkins_cfg_verify
505
506     properties:
507       - github:
508           url: "{github-url}/{github-org}/{project}"
509
510     scm:
511       - lf-infra-github-scm:
512           url: "{git-clone-url}{github-org}/{project}"
513           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
514           branch: "$sha1"
515           submodule-recursive: true
516           submodule-timeout: "{submodule-timeout}"
517           submodule-disable: "{submodule-disable}"
518           choosing-strategy: default
519           jenkins-ssh-credential: "{jenkins-ssh-credential}"
520
521     triggers:
522       - github-pull-request:
523           trigger-phrase: "^(recheck|reverify)$"
524           only-trigger-phrase: false
525           status-context: "Jenkins CFG Verify"
526           permit-all: true
527           github-hooks: true
528           included-regions: "{obj:github_included_regions}"
529           white-list-target-branches:
530             - "{branch}"
531
532 ###########################
533 # JENKINS SANDBOX CLEANUP #
534 ###########################
535
536 - lf_jenkins_sandbox_cleanup: &lf_jenkins_sandbox_cleanup
537     name: lf-jenkins-sandbox-cleanup
538
539     ######################
540     # Default parameters #
541     ######################
542
543     build-timeout: 30
544     # Run every Saturday at 08:00 UTC
545     cron: "0 8 * * 6"
546     disable-job: false
547
548     #####################
549     # Job Configuration #
550     #####################
551
552     project-type: freestyle
553     node: "{build-node}"
554     concurrent: true
555     disabled: "{disable-job}"
556
557     parameters:
558       - lf-infra-jjb-parameters:
559           jjb-cache: "{jjb-cache}"
560           jjb-version: "{jjb-version}"
561
562     triggers:
563       - timed: "{obj:cron}"
564
565     builders:
566       - lf-infra-jjbini
567       - shell: !include-raw-escape:
568           - ../shell/jenkins-sandbox-cleanup.sh
569
570 - job-template:
571     name: "{project-name}-jenkins-sandbox-cleanup"
572     id: gerrit-jenkins-sandbox-cleanup
573     <<: *lf_jjb_common
574     # yamllint disable-line rule:key-duplicates
575     <<: *lf_jenkins_sandbox_cleanup
576
577 - job-template:
578     name: "{project-name}-jenkins-sandbox-cleanup"
579     id: github-jenkins-sandbox-cleanup
580     <<: *lf_jjb_common
581     # yamllint disable-line rule:key-duplicates
582     <<: *lf_jenkins_sandbox_cleanup
583
584 ##################
585 # JJB DEPLOY JOB #
586 ##################
587
588 - lf_jjb_deploy_job: &lf_jjb_deploy_job
589     name: lf-jjb-deploy-job
590
591     ######################
592     # Default parameters #
593     ######################
594
595     branch: master
596     disable-job: false
597     # jjb-deploy should always clone $PROJECT regardless of what
598     # $GERRIT_PROJECT triggered the job.
599     git-url: "$GIT_URL/$PROJECT"
600     github-url: "https://github.com"
601     stream: master
602     submodule-timeout: 10
603     submodule-disable: false
604     gerrit_jjb_deploy_job_triggers:
605       - comment-added-contains-event:
606           comment-contains-value: '^Patch Set\s+\d+:\s+(jjb-deploy[:]* (?!\*+$).+$)'
607
608     #####################
609     # Job Configuration #
610     #####################
611
612     project-type: freestyle
613     node: "{build-node}"
614     concurrent: true
615     disabled: "{disable-job}"
616
617     properties:
618       - lf-infra-properties:
619           project: "{project}"
620           build-days-to-keep: 1
621
622     parameters:
623       - lf-infra-parameters:
624           project: "{project}"
625           stream: "{stream}"
626           branch: "{branch}"
627
628     wrappers:
629       - lf-infra-wrappers:
630           build-timeout: 5
631           jenkins-ssh-credential: "{jenkins-ssh-credential}"
632
633     builders:
634       - lf-pip-install:
635           pip-packages: jenkins-job-builder
636       - lf-infra-jjbini
637       - shell: !include-raw-escape: ../shell/jjb-deploy-job.sh
638
639     publishers:
640       - lf-infra-publish
641
642 - job-template:
643     name: "{project-name}-jjb-deploy-job"
644     id: gerrit-jjb-deploy-job
645     <<: *lf_jjb_deploy_job
646
647     scm:
648       - lf-infra-gerrit-scm:
649           git-url: "{git-url}"
650           refspec: "refs/heads/{branch}"
651           branch: "{branch}"
652           submodule-recursive: true
653           submodule-timeout: "{submodule-timeout}"
654           submodule-disable: "{submodule-disable}"
655           choosing-strategy: default
656           jenkins-ssh-credential: "{jenkins-ssh-credential}"
657
658     triggers:
659       - gerrit:
660           server-name: "{gerrit-server-name}"
661           trigger-on: "{obj:gerrit_jjb_deploy_job_triggers}"
662           projects:
663             - project-compare-type: ANT
664               project-pattern: "**"
665               branches:
666                 - branch-compare-type: ANT
667                   branch-pattern: "**"
668           skip-vote:
669             success: true
670             failed: true
671             unstable: true
672             notbuilt: true
673
674 - job-template:
675     name: "{project-name}-jjb-deploy-job"
676     id: github-jjb-deploy-job
677     <<: *lf_jjb_deploy_job
678
679     properties:
680       - lf-infra-properties:
681           project: "{project}"
682           build-days-to-keep: 1
683       - github:
684           url: "{github-url}/{github-org}/{project}"
685
686     scm:
687       - lf-infra-github-scm:
688           url: "{git-clone-url}{github-org}/{project}"
689           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
690           branch: "$sha1"
691           submodule-recursive: true
692           submodule-timeout: "{submodule-timeout}"
693           submodule-disable: "{submodule-disable}"
694           choosing-strategy: default
695           jenkins-ssh-credential: "{jenkins-ssh-credential}"
696
697     triggers:
698       - github-pull-request:
699           trigger-phrase: '^jjb-deploy (?!\*+$).+$'
700           only-trigger-phrase: true
701           status-context: "JJB Deploy Job"
702           permit-all: true
703           github-hooks: true
704           white-list-target-branches:
705             - "{branch}"
706
707 #############
708 # JJB Merge #
709 #############
710
711 - lf_jjb_merge: &lf_jjb_merge
712     name: lf-jjb-merge
713
714     ######################
715     # Default parameters #
716     ######################
717
718     jjb-workers: 0
719
720     gerrit_merge_triggers:
721       - change-merged-event
722       - comment-added-contains-event:
723           comment-contains-value: '^Patch Set\s+\d+:\s+remerge\s*$'
724
725     #####################
726     # Job Configuration #
727     #####################
728
729     builders:
730       - lf-infra-pre-build
731       - lf-infra-jjbini
732       - inject:
733           properties-content: JJB_WORKERS={jjb-workers}
734       - shell: !include-raw-escape:
735           - ../shell/jjb-merge-job.sh
736
737 - job-template:
738     name: "{project-name}-jjb-merge"
739     id: gerrit-jjb-merge
740     <<: *lf_jjb_common
741     # yamllint disable-line rule:key-duplicates
742     <<: *lf_jjb_merge
743
744     git-url: "$GIT_URL/$GERRIT_PROJECT"
745
746     scm:
747       - lf-infra-gerrit-scm:
748           git-url: "{git-url}"
749           refspec: ""
750           branch: "{branch}"
751           submodule-recursive: "{submodule-recursive}"
752           submodule-timeout: "{submodule-timeout}"
753           submodule-disable: "{submodule-disable}"
754           choosing-strategy: default
755           jenkins-ssh-credential: "{jenkins-ssh-credential}"
756
757     triggers:
758       - gerrit:
759           server-name: "{gerrit-server-name}"
760           trigger-on: "{obj:gerrit_merge_triggers}"
761           projects:
762             - project-compare-type: ANT
763               project-pattern: "{project}"
764               branches:
765                 - branch-compare-type: ANT
766                   branch-pattern: "**/{branch}"
767               file-paths: "{obj:gerrit_trigger_file_paths}"
768
769 - job-template:
770     name: "{project-name}-jjb-merge"
771     id: github-jjb-merge
772     <<: *lf_jjb_common
773     # yamllint disable-line rule:key-duplicates
774     <<: *lf_jjb_merge
775
776     #####################
777     # Job Configuration #
778     #####################
779
780     properties:
781       - lf-infra-properties:
782           project: "{project}"
783           build-days-to-keep: 7
784       - github:
785           url: "{github-url}/{github-org}/{project}"
786
787     scm:
788       - lf-infra-github-scm:
789           url: "{git-clone-url}{github-org}/{project}"
790           refspec: ""
791           branch: "refs/heads/{branch}"
792           submodule-recursive: "{submodule-recursive}"
793           submodule-timeout: "{submodule-timeout}"
794           submodule-disable: "{submodule-disable}"
795           choosing-strategy: default
796           jenkins-ssh-credential: "{jenkins-ssh-credential}"
797
798     triggers:
799       - github
800       - pollscm:
801           cron: ""
802       - github-pull-request:
803           trigger-phrase: "^remerge$"
804           only-trigger-phrase: true
805           status-context: "JJB Merge"
806           permit-all: true
807           github-hooks: true
808           org-list:
809             - "{github-org}"
810           white-list: "{obj:github_pr_whitelist}"
811           admin-list: "{obj:github_pr_admin_list}"
812           included-regions: "{obj:github_included_regions}"
813           white-list-target-branches:
814             - "{branch}"
815
816 ##############
817 # JJB Verify #
818 ##############
819
820 - lf_jjb_verify: &lf_jjb_verify
821     name: lf-jjb-verify
822
823     ######################
824     # Default parameters #
825     ######################
826
827     build-concurrent: true
828
829     gerrit_verify_triggers:
830       - patchset-created-event:
831           exclude-drafts: true
832           exclude-trivial-rebase: false
833           exclude-no-code-change: false
834       - draft-published-event
835       - comment-added-contains-event:
836           comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
837
838     #####################
839     # Job Configuration #
840     #####################
841
842     concurrent: "{build-concurrent}"
843
844     builders:
845       - lf-infra-pre-build
846       - lf-infra-jjbini
847       - shell: !include-raw-escape:
848           - ../shell/jjb-verify-job.sh
849       - lf-infra-gpg-verify-git-signature
850
851 - job-template:
852     name: "{project-name}-jjb-verify"
853     id: gerrit-jjb-verify
854     <<: *lf_jjb_common
855     # yamllint disable-line rule:key-duplicates
856     <<: *lf_jjb_verify
857
858     ######################
859     # Default parameters #
860     ######################
861
862     git-url: "$GIT_URL/$GERRIT_PROJECT"
863
864     #####################
865     # Job Configuration #
866     #####################
867
868     scm:
869       - lf-infra-gerrit-scm:
870           git-url: "{git-url}"
871           refspec: "$GERRIT_REFSPEC"
872           branch: "$GERRIT_BRANCH"
873           submodule-recursive: "{submodule-recursive}"
874           submodule-timeout: "{submodule-timeout}"
875           submodule-disable: "{submodule-disable}"
876           choosing-strategy: gerrit
877           jenkins-ssh-credential: "{jenkins-ssh-credential}"
878
879     triggers:
880       - gerrit:
881           server-name: "{gerrit-server-name}"
882           trigger-on: "{obj:gerrit_verify_triggers}"
883           projects:
884             - project-compare-type: ANT
885               project-pattern: "{project}"
886               branches:
887                 - branch-compare-type: ANT
888                   branch-pattern: "**/{branch}"
889               file-paths: "{obj:gerrit_trigger_file_paths}"
890
891 - job-template:
892     name: "{project-name}-jjb-verify"
893     id: github-jjb-verify
894     <<: *lf_jjb_common
895     # yamllint disable-line rule:key-duplicates
896     <<: *lf_jjb_verify
897
898     #####################
899     # Job Configuration #
900     #####################
901
902     properties:
903       - lf-infra-properties:
904           project: "{project}"
905           build-days-to-keep: 7
906       - github:
907           url: "{github-url}/{github-org}/{project}"
908
909     scm:
910       - lf-infra-github-scm:
911           url: "{git-clone-url}{github-org}/{project}"
912           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
913           branch: "$sha1"
914           submodule-recursive: "{submodule-recursive}"
915           submodule-timeout: "{submodule-timeout}"
916           submodule-disable: "{submodule-disable}"
917           choosing-strategy: default
918           jenkins-ssh-credential: "{jenkins-ssh-credential}"
919
920     triggers:
921       - github-pull-request:
922           trigger-phrase: "^(recheck|reverify)$"
923           only-trigger-phrase: false
924           status-context: "JJB Verify"
925           permit-all: true
926           github-hooks: true
927           included-regions: "{obj:github_included_regions}"
928           white-list-target-branches:
929             - "{branch}"
930
931 ############################
932 # JJB Verify Upstream GJJB #
933 ############################
934
935 - lf_jjb_verify: &lf_jjb_verify_upstream_gjjb
936     name: lf-jjb-verify-upstream-gjjb
937
938     #####################
939     # Job Configuration #
940     #####################
941
942     concurrent: true
943
944     builders:
945       - shell: |
946           cd global-jjb
947           git fetch https://gerrit.linuxfoundation.org/infra/releng/global-jjb $GERRIT_REFSPEC
948           git cherry-pick FETCH_HEAD
949       - lf-infra-jjbini
950       - shell: !include-raw-escape:
951           - ../shell/jjb-verify-job.sh
952       - lf-infra-gpg-verify-git-signature
953
954 - job-template:
955     name: "{project-name}-jjb-verify-upstream-gjjb"
956     id: gerrit-jjb-verify-upstream-gjjb
957     <<: *lf_jjb_common
958     # yamllint disable-line rule:key-duplicates
959     <<: *lf_jjb_verify_upstream_gjjb
960
961     ######################
962     # Default parameters #
963     ######################
964
965     git-url: "$GIT_URL/$PROJECT"
966     submodule-timeout: 10
967     submodule-disable: false
968
969     #####################
970     # Job Configuration #
971     #####################
972
973     scm:
974       - lf-infra-gerrit-scm:
975           git-url: "{git-url}"
976           refspec: ""
977           branch: "master"
978           submodule-recursive: true
979           submodule-timeout: "{submodule-timeout}"
980           submodule-disable: "{submodule-disable}"
981           choosing-strategy: default
982           jenkins-ssh-credential: "{jenkins-ssh-credential}"
983
984     triggers:
985       - gerrit:
986           server-name: "LinuxFoundation"
987           trigger-on:
988             - patchset-created-event:
989                 exclude-drafts: true
990                 exclude-trivial-rebase: false
991                 exclude-no-code-change: false
992             - draft-published-event
993             - comment-added-contains-event:
994                 comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
995           projects:
996             - project-compare-type: ANT
997               project-pattern: "releng/global-jjb"
998               branches:
999                 - branch-compare-type: ANT
1000                   branch-pattern: "**/master"
1001           override-votes: true
1002           gerrit-build-failed-codereview-value: -1
1003           gerrit-build-failed-verified-value: 0
1004           gerrit-build-successful-codereview-value: 1
1005           gerrit-build-successful-verified-value: 0
1006
1007 #################
1008 # License Check #
1009 #################
1010
1011 - lf_license_check: &lf_license_check
1012     name: lf-license-check
1013
1014     ######################
1015     # Default parameters #
1016     ######################
1017
1018     branch: master
1019     build-days-to-keep: 7
1020     build-timeout: 15
1021     disable-job: false
1022     file-patterns: >
1023       *.go
1024       *.groovy
1025       *.java
1026       *.py
1027       *.sh
1028     git-url: "$GIT_URL/$PROJECT"
1029     github-url: "https://github.com"
1030     lhc-version: 0.2.0
1031     license-exclude-paths: ""
1032     licenses-allowed: Apache-2.0,EPL-1.0,MIT
1033     project-pattern: "**"
1034     spdx-disable: false
1035     stream: master
1036     submodule-timeout: 10
1037     submodule-disable: false
1038
1039     #####################
1040     # Job Configuration #
1041     #####################
1042
1043     project-type: freestyle
1044     node: "{build-node}"
1045     concurrent: true
1046     disabled: "{disable-job}"
1047
1048     properties:
1049       - lf-infra-properties:
1050           build-days-to-keep: "{build-days-to-keep}"
1051
1052     parameters:
1053       - lf-infra-parameters:
1054           project: "{project}"
1055           branch: "{branch}"
1056           stream: "{stream}"
1057
1058     wrappers:
1059       - lf-infra-wrappers:
1060           build-timeout: "{build-timeout}"
1061           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1062
1063     builders:
1064       - lf-license-check:
1065           file-patterns: "{file-patterns}"
1066           spdx-disable: "{spdx-disable}"
1067           lhc-version: "{lhc-version}"
1068           license-exclude-paths: "{license-exclude-paths}"
1069           licenses-allowed: "{licenses-allowed}"
1070
1071     publishers:
1072       - lf-infra-publish
1073
1074 - job-template:
1075     name: "{project-name}-license-check"
1076     id: gerrit-license-check
1077     <<: *lf_license_check
1078
1079     git-url: "$GIT_URL/$GERRIT_PROJECT"
1080
1081     scm:
1082       - lf-infra-gerrit-scm:
1083           git-url: "{git-url}"
1084           refspec: "$GERRIT_REFSPEC"
1085           branch: "$GERRIT_BRANCH"
1086           # Submodules are out of the project's control
1087           submodule-recursive: false
1088           submodule-timeout: "{submodule-timeout}"
1089           submodule-disable: "{submodule-disable}"
1090           choosing-strategy: gerrit
1091           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1092
1093     triggers:
1094       - gerrit:
1095           server-name: "{gerrit-server-name}"
1096           # Trigger should not be overridable as we want to always run
1097           trigger-on:
1098             - patchset-created-event:
1099                 exclude-drafts: false
1100                 exclude-trivial-rebase: false
1101                 exclude-no-code-change: false
1102             - draft-published-event
1103             - comment-added-contains-event:
1104                 comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
1105           projects:
1106             - project-compare-type: ANT
1107               project-pattern: "{project-pattern}"
1108               branches:
1109                 - branch-compare-type: ANT
1110                   branch-pattern: "**"
1111
1112 - job-template:
1113     name: "{project-name}-license-check"
1114     id: github-license-check
1115     <<: *lf_license_check
1116
1117     properties:
1118       - lf-infra-properties:
1119           build-days-to-keep: "{build-days-to-keep}"
1120       - github:
1121           url: "{github-url}/{github-org}/{project}"
1122
1123     scm:
1124       - lf-infra-github-scm:
1125           url: "{git-clone-url}{github-org}/{project}"
1126           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
1127           branch: "$sha1"
1128           # Submodules are out of the project's control
1129           submodule-recursive: false
1130           submodule-timeout: "{submodule-timeout}"
1131           submodule-disable: "{submodule-disable}"
1132           choosing-strategy: default
1133           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1134
1135     triggers:
1136       - github-pull-request:
1137           trigger-phrase: "^recheck$"
1138           only-trigger-phrase: false
1139           status-context: "License Check"
1140           permit-all: true
1141           github-hooks: true
1142           white-list-target-branches:
1143             - "{branch}"
1144
1145 ####################
1146 # Info YAML Verify #
1147 ####################
1148
1149 - lf_info_yaml_verify: &lf_info_yaml_verify
1150     name: lf-info-yaml-verify
1151
1152     ######################
1153     # Default parameters #
1154     ######################
1155
1156     gerrit_verify_triggers:
1157       - patchset-created-event:
1158           exclude-drafts: true
1159           exclude-trivial-rebase: false
1160           exclude-no-code-change: false
1161       - draft-published-event
1162       - comment-added-contains-event:
1163           comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
1164
1165     #####################
1166     # Job Configuration #
1167     #####################
1168
1169     concurrent: true
1170
1171     builders:
1172       - shell: !include-raw-escape:
1173           - ../shell/git-validate-info-yaml.sh
1174           - ../shell/info-file-validate.sh
1175
1176 - job-template:
1177     name: "{project-name}-info-yaml-verify"
1178     id: gerrit-info-yaml-verify
1179     <<: *lf_jjb_common
1180     # yamllint disable-line rule:key-duplicates
1181     <<: *lf_info_yaml_verify
1182
1183     git-url: "$GIT_URL/$GERRIT_PROJECT"
1184
1185     scm:
1186       - lf-infra-gerrit-scm:
1187           git-url: "{git-url}"
1188           refspec: "$GERRIT_REFSPEC"
1189           branch: "$GERRIT_BRANCH"
1190           submodule-recursive: "{submodule-recursive}"
1191           submodule-timeout: "{submodule-timeout}"
1192           submodule-disable: "{submodule-disable}"
1193           choosing-strategy: gerrit
1194           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1195
1196     triggers:
1197       - gerrit:
1198           server-name: "{gerrit-server-name}"
1199           trigger-on: "{obj:gerrit_verify_triggers}"
1200           projects:
1201             - project-compare-type: ANT
1202               project-pattern: "{project}"
1203               branches:
1204                 - branch-compare-type: ANT
1205                   branch-pattern: "**/{branch}"
1206               file-paths:
1207                 - compare-type: REG_EXP
1208                   pattern: "INFO.yaml"
1209
1210 - job-template:
1211     name: "{project-name}-info-yaml-verify"
1212     id: github-info-yaml-verify
1213     <<: *lf_jjb_common
1214     # yamllint disable-line rule:key-duplicates
1215     <<: *lf_info_yaml_verify
1216
1217     github-url: "https://github.com"
1218     properties:
1219       - github:
1220           url: "{github-url}/{github-org}/{project}"
1221
1222     scm:
1223       - lf-infra-github-scm:
1224           url: "{git-clone-url}{github-org}/{project}"
1225           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
1226           branch: "$sha1"
1227           submodule-recursive: "{submodule-recursive}"
1228           submodule-timeout: "{submodule-timeout}"
1229           submodule-disable: "{submodule-disable}"
1230           choosing-strategy: default
1231           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1232
1233     triggers:
1234       - github-pull-request:
1235           trigger-phrase: "^(recheck|reverify)$"
1236           only-trigger-phrase: false
1237           status-context: "INFO File Verify"
1238           permit-all: true
1239           github-hooks: true
1240           # included-regions MUST match gerrit file-paths
1241           included-regions: "INFO.yaml"
1242           white-list-target-branches:
1243             - "{branch}"
1244
1245 ##################
1246 # OPENSTACK CRON #
1247 ##################
1248
1249 - lf_openstack_cron: &lf_openstack_cron
1250     name: lf-openstack-cron
1251
1252     ######################
1253     # Default parameters #
1254     ######################
1255
1256     branch: master
1257     build-days-to-keep: 7
1258     build-timeout: 10
1259     cron: "@hourly"
1260     disable-job: false
1261     git-url: "$GIT_URL/$PROJECT"
1262     github-url: "https://github.com"
1263     openstack-cloud: vex
1264     openstack-image-cleanup: true
1265     openstack-image-cleanup-age: 30
1266     openstack-image-protect: true
1267     openstack-port-cleanup: true
1268     openstack-server-cleanup: true
1269     openstack-stack-cleanup: true
1270     openstack-volume-cleanup: true
1271     stream: master
1272     submodule-timeout: 10
1273     submodule-disable: false
1274
1275     #####################
1276     # Job Configuration #
1277     #####################
1278
1279     project-type: freestyle
1280     node: "{build-node}"
1281     concurrent: false
1282     disabled: "{disable-job}"
1283
1284     properties:
1285       - lf-infra-properties:
1286           build-days-to-keep: "{build-days-to-keep}"
1287
1288     parameters:
1289       - lf-infra-parameters:
1290           project: "{project}"
1291           stream: "{stream}"
1292           branch: "{branch}"
1293       - string:
1294           name: JENKINS_URLS
1295           default: "{jenkins-urls}"
1296           description: |
1297             Space separated list of Jenkins URLs to check for active builds.
1298
1299     wrappers:
1300       - lf-infra-wrappers:
1301           build-timeout: "{build-timeout}"
1302           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1303       # Listed after to override openstack-infra-wrappers clouds.yaml definition
1304       - config-file-provider:
1305           files:
1306             - file-id: clouds-yaml
1307               target: "$HOME/.config/openstack/clouds.yaml"
1308             - file-id: npmrc
1309               target: "$HOME/.npmrc"
1310             - file-id: pipconf
1311               target: "$HOME/.config/pip/pip.conf"
1312
1313     triggers:
1314       - timed: "{obj:cron}"
1315
1316     builders:
1317       - lf-infra-pre-build
1318       - inject:
1319           properties-content: OS_CLOUD={openstack-cloud}
1320       # Stacks
1321       - conditional-step:
1322           condition-kind: boolean-expression
1323           condition-expression: "{openstack-stack-cleanup}"
1324           steps:
1325             - shell: !include-raw-escape: ../shell/openstack-cleanup-orphaned-stacks.sh
1326       # Servers
1327       - conditional-step:
1328           condition-kind: boolean-expression
1329           condition-expression: "{openstack-server-cleanup}"
1330           steps:
1331             - shell: !include-raw-escape: ../shell/openstack-cleanup-orphaned-servers.sh
1332       # Ports
1333       - conditional-step:
1334           condition-kind: boolean-expression
1335           condition-expression: "{openstack-port-cleanup}"
1336           steps:
1337             - shell: !include-raw-escape: ../shell/openstack-cleanup-orphaned-ports.sh
1338       # Volumes
1339       - conditional-step:
1340           condition-kind: boolean-expression
1341           condition-expression: "{openstack-volume-cleanup}"
1342           steps:
1343             - shell: !include-raw-escape: ../shell/openstack-cleanup-orphaned-volumes.sh
1344       # Images
1345       - conditional-step:
1346           condition-kind: boolean-expression
1347           condition-expression: "{openstack-image-protect}"
1348           steps:
1349             - shell: !include-raw-escape: ../shell/openstack-protect-in-use-images.sh
1350       - conditional-step:
1351           condition-kind: boolean-expression
1352           condition-expression: "{openstack-image-cleanup}"
1353           steps:
1354             - inject:
1355                 properties-content: OS_IMAGE_CLEANUP_AGE={openstack-image-cleanup-age}
1356             - shell: !include-raw-escape: ../shell/openstack-cleanup-old-images.sh
1357
1358     publishers:
1359       - lf-infra-publish
1360
1361 - job-template:
1362     name: "{project-name}-openstack-cron"
1363     id: gerrit-openstack-cron
1364     <<: *lf_openstack_cron
1365
1366     scm:
1367       - lf-infra-gerrit-scm:
1368           git-url: "{git-url}"
1369           refspec: "refs/heads/{branch}"
1370           branch: "{branch}"
1371           submodule-recursive: true
1372           submodule-timeout: "{submodule-timeout}"
1373           submodule-disable: "{submodule-disable}"
1374           choosing-strategy: default
1375           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1376
1377 - job-template:
1378     name: "{project-name}-openstack-cron"
1379     id: github-openstack-cron
1380     <<: *lf_openstack_cron
1381
1382     scm:
1383       - lf-infra-github-scm:
1384           url: "{git-clone-url}{github-org}/{project}"
1385           refspec: ""
1386           branch: "refs/heads/{branch}"
1387           submodule-recursive: true
1388           submodule-timeout: "{submodule-timeout}"
1389           submodule-disable: "{submodule-disable}"
1390           choosing-strategy: default
1391           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1392
1393 ################
1394 # Packer Merge #
1395 ################
1396
1397 - lf_packer_merge: &lf_packer_merge
1398     name: lf-packer-merge
1399
1400     ######################
1401     # Default parameters #
1402     ######################
1403
1404     openstack: true
1405     openstack-cloud: vex
1406     update-cloud-image: false
1407
1408     #####################
1409     # Job Configuration #
1410     #####################
1411
1412     parameters:
1413       - lf-infra-parameters:
1414           project: "{project}"
1415           stream: "{stream}"
1416           branch: "{branch}"
1417       - lf-packer-parameters:
1418           packer-version: "{packer-version}"
1419       - bool:
1420           name: UPDATE_CLOUD_IMAGE
1421           default: "{update-cloud-image}"
1422           description: "Update new built image on the cloud."
1423
1424     builders:
1425       - lf-infra-packer-build:
1426           openstack: "{openstack}"
1427           openstack-cloud: "{openstack-cloud}"
1428           packer-cloud-settings: "{packer-cloud-settings}"
1429           packer-version: "{packer-version}"
1430           platform: "{platforms}"
1431           template: "{templates}"
1432           update-cloud-image: "{update-cloud-image}"
1433       - description-setter:
1434           regexp: '(\s+.*)(ZZCI\s+.*\d+-\d+\.\d+)'
1435           description: 'Image: \2'
1436       # - trigger-builds:
1437       #     - project: '{project-name}-openstack-update-cloud-image'
1438       #       block: false
1439       #       predefined-parameters: |
1440       #         GERRIT_BRANCH=$GERRIT_BRANCH
1441       #         GERRIT_PROJECT=$GERRIT_PROJECT
1442       #         GERRIT_REFSPEC=$GERRIT_REFSPEC
1443       #         NEW_IMAGE_NAME=$NEW_IMAGE_NAME
1444       #       property-file: variables.jenkins-trigger
1445       #       property-file-fail-on-missing: true
1446
1447     publishers:
1448       - lf-infra-publish
1449       - trigger-parameterized-builds:
1450           - project: "{project-name}-openstack-update-cloud-image"
1451             condition: UNSTABLE_OR_BETTER
1452             predefined-parameters: |
1453               NEW_IMAGE_NAME=$NEW_IMAGE_NAME
1454             property-file: variables.jenkins-trigger
1455             fail-on-missing: true
1456
1457 - job-template:
1458     name: "{project-name}-packer-merge-{platforms}-{templates}"
1459     id: gerrit-packer-merge
1460     <<: *lf_packer_common
1461     # yamllint disable-line rule:key-duplicates
1462     <<: *lf_packer_merge
1463
1464     ######################
1465     # Default parameters #
1466     ######################
1467
1468     git-url: "$GIT_URL/$GERRIT_PROJECT"
1469
1470     gerrit_merge_triggers:
1471       - change-merged-event
1472       - comment-added-contains-event:
1473           comment-contains-value: '^Patch Set\s+\d+:\s+remerge\s*$'
1474
1475     #####################
1476     # Job Configuration #
1477     #####################
1478
1479     scm:
1480       - lf-infra-gerrit-scm:
1481           git-url: "{git-url}"
1482           refspec: "$GERRIT_REFSPEC"
1483           branch: "$GERRIT_BRANCH"
1484           submodule-recursive: "{submodule-recursive}"
1485           submodule-timeout: "{submodule-timeout}"
1486           submodule-disable: "{submodule-disable}"
1487           choosing-strategy: default
1488           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1489
1490     triggers:
1491       - timed: "{obj:cron}"
1492       - gerrit:
1493           server-name: "{gerrit-server-name}"
1494           trigger-on: "{obj:gerrit_merge_triggers}"
1495           projects:
1496             - project-compare-type: ANT
1497               project-pattern: "{project}"
1498               branches:
1499                 - branch-compare-type: ANT
1500                   branch-pattern: "**/{branch}"
1501               file-paths:
1502                 - compare-type: REG_EXP
1503                   pattern: 'packer\/provision\/.*\.sh'
1504                 - compare-type: REG_EXP
1505                   pattern: 'packer\/provision\/.*\.bat'
1506                 - compare-type: REG_EXP
1507                   pattern: 'packer\/provision\/.*\.ps1'
1508                 - compare-type: REG_EXP
1509                   pattern: 'packer\/provision\/{templates}\.yaml'
1510                 - compare-type: REG_EXP
1511                   pattern: 'packer\/provision\/local-{templates}\.yaml'
1512                 - compare-type: REG_EXP
1513                   pattern: 'packer\/templates\/{templates}\.json'
1514                 - compare-type: REG_EXP
1515                   pattern: 'packer\/vars\/{platforms}\.json'
1516
1517 - job-template:
1518     name: "{project-name}-packer-merge-{platforms}-{templates}"
1519     id: github-packer-merge
1520     <<: *lf_packer_common
1521     # yamllint disable-line rule:key-duplicates
1522     <<: *lf_packer_merge
1523
1524     #####################
1525     # Job Configuration #
1526     #####################
1527
1528     properties:
1529       - lf-infra-properties:
1530           project: "{project}"
1531           build-days-to-keep: 7
1532       - github:
1533           url: "{github-url}/{github-org}/{project}"
1534
1535     scm:
1536       - lf-infra-github-scm:
1537           url: "{git-clone-url}{github-org}/{project}"
1538           refspec: >
1539             +refs/heads/*:refs/remotes/origin/*
1540             +refs/pull/*:refs/remotes/origin/pr/*
1541           branch: "$GERRIT_REFSPEC"
1542           submodule-recursive: "{submodule-recursive}"
1543           submodule-timeout: "{submodule-timeout}"
1544           submodule-disable: "{submodule-disable}"
1545           choosing-strategy: default
1546           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1547
1548     triggers:
1549       - timed: "{obj:cron}"
1550       - github
1551       - pollscm:
1552           cron: ""
1553
1554       - github-pull-request:
1555           trigger-phrase: "^remerge$"
1556           only-trigger-phrase: true
1557           status-context: "Packer {platforms}-{templates} Merge"
1558           permit-all: true
1559           github-hooks: true
1560           org-list:
1561             - "{github-org}"
1562           white-list: "{obj:github_pr_whitelist}"
1563           admin-list: "{obj:github_pr_admin_list}"
1564           # included-regions MUST match Gerrit Trigger file-paths
1565           included-regions:
1566             - 'packer\/provision\/.*\.sh'
1567             - 'packer\/provision\/.*\.bat'
1568             - 'packer\/provision\/.*\.ps1'
1569             - 'packer\/provision\/{templates}\.yaml'
1570             - 'packer\/provision\/local-{templates}\.yaml'
1571             - 'packer\/templates\/{templates}\.json'
1572             - 'packer\/vars\/{platforms}\.json'
1573           white-list-target-branches:
1574             - "{branch}"
1575
1576 #################
1577 # Packer Verify #
1578 #################
1579
1580 - lf_packer_verify: &lf_packer_verify
1581     name: lf-packer-verify
1582
1583     ######################
1584     # Default parameters #
1585     ######################
1586
1587     build-timeout: 10
1588     openstack: true
1589     openstack-cloud: vex
1590
1591     gerrit_verify_triggers:
1592       - patchset-created-event:
1593           exclude-drafts: true
1594           exclude-trivial-rebase: false
1595           exclude-no-code-change: false
1596       - draft-published-event
1597       - comment-added-contains-event:
1598           comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
1599
1600     gerrit_trigger_file_paths:
1601       - compare-type: REG_EXP
1602         pattern: 'packer\/.*'
1603
1604     # github_included_regions MUST match gerrit_trigger_file_paths
1605     github_included_regions:
1606       - 'packer\/.*'
1607
1608     #####################
1609     # Job Configuration #
1610     #####################
1611
1612     concurrent: true
1613
1614     builders:
1615       - lf-infra-packer-validate:
1616           openstack: "{openstack}"
1617           openstack-cloud: "{openstack-cloud}"
1618           packer-cloud-settings: "{packer-cloud-settings}"
1619           packer-version: "{packer-version}"
1620
1621 - job-template:
1622     name: "{project-name}-packer-verify"
1623     id: gerrit-packer-verify
1624     <<: *lf_packer_common
1625     # yamllint disable-line rule:key-duplicates
1626     <<: *lf_packer_verify
1627
1628     ######################
1629     # Default parameters #
1630     ######################
1631
1632     git-url: "$GIT_URL/$GERRIT_PROJECT"
1633
1634     #####################
1635     # Job Configuration #
1636     #####################
1637
1638     scm:
1639       - lf-infra-gerrit-scm:
1640           git-url: "{git-url}"
1641           refspec: "$GERRIT_REFSPEC"
1642           branch: "$GERRIT_BRANCH"
1643           submodule-recursive: "{submodule-recursive}"
1644           submodule-timeout: "{submodule-timeout}"
1645           submodule-disable: "{submodule-disable}"
1646           choosing-strategy: gerrit
1647           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1648
1649     triggers:
1650       - gerrit:
1651           server-name: "{gerrit-server-name}"
1652           trigger-on: "{obj:gerrit_verify_triggers}"
1653           projects:
1654             - project-compare-type: ANT
1655               project-pattern: "{project}"
1656               branches:
1657                 - branch-compare-type: ANT
1658                   branch-pattern: "**/{branch}"
1659               file-paths: "{obj:gerrit_trigger_file_paths}"
1660
1661 - job-template:
1662     name: "{project-name}-packer-verify"
1663     id: github-packer-verify
1664     <<: *lf_packer_common
1665     # yamllint disable-line rule:key-duplicates
1666     <<: *lf_packer_verify
1667
1668     #####################
1669     # Job Configuration #
1670     #####################
1671
1672     properties:
1673       - lf-infra-properties:
1674           project: "{project}"
1675           build-days-to-keep: 7
1676       - github:
1677           url: "{github-url}/{github-org}/{project}"
1678
1679     scm:
1680       - lf-infra-github-scm:
1681           url: "{git-clone-url}{github-org}/{project}"
1682           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
1683           branch: "$sha1"
1684           submodule-recursive: "{submodule-recursive}"
1685           submodule-timeout: "{submodule-timeout}"
1686           submodule-disable: "{submodule-disable}"
1687           choosing-strategy: default
1688           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1689
1690     triggers:
1691       - github-pull-request:
1692           trigger-phrase: "^(recheck|reverify)$"
1693           only-trigger-phrase: false
1694           status-context: "Packer Verify"
1695           permit-all: true
1696           github-hooks: true
1697           included-regions: "{obj:github_included_regions}"
1698           white-list-target-branches:
1699             - "{branch}"
1700
1701 ################################
1702 # Openstack Update Cloud Image #
1703 ################################
1704
1705 - lf_openstack_cron: &lf_openstack_update_cloud_image
1706     name: lf-openstack-update-cloud-image
1707
1708     ######################
1709     # Default parameters #
1710     ######################
1711
1712     branch: master
1713     build-days-to-keep: 7
1714     build-timeout: 10
1715     cron: "@monthly"
1716     disable-job: false
1717     git-url: "$GIT_URL/$PROJECT"
1718     github-url: "https://github.com"
1719     new-image-name: "all"
1720     openstack-cloud: vex
1721     stream: master
1722     submodule-timeout: 10
1723     submodule-disable: false
1724     update-cloud-image: false
1725
1726     #####################
1727     # Job Configuration #
1728     #####################
1729
1730     project-type: freestyle
1731     node: "{build-node}"
1732     concurrent: false
1733     disabled: "{disable-job}"
1734
1735     properties:
1736       - lf-infra-properties:
1737           build-days-to-keep: "{build-days-to-keep}"
1738
1739     parameters:
1740       - lf-infra-parameters:
1741           project: "{project}"
1742           stream: "{stream}"
1743           branch: "{branch}"
1744       - string:
1745           name: NEW_IMAGE_NAME
1746           default: "{new-image-name}"
1747           description: "Name of cloud image to update in Jenkins"
1748
1749     wrappers:
1750       - lf-infra-wrappers:
1751           build-timeout: "{build-timeout}"
1752           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1753       # Listed after to override openstack-infra-wrappers clouds.yaml definition
1754       - config-file-provider:
1755           files:
1756             - file-id: clouds-yaml
1757               target: "$HOME/.config/openstack/clouds.yaml"
1758             - file-id: npmrc
1759               target: "$HOME/.npmrc"
1760             - file-id: pipconf
1761               target: "$HOME/.config/pip/pip.conf"
1762
1763     builders:
1764       - lf-infra-pre-build
1765       - inject:
1766           properties-content: |
1767             OS_CLOUD={openstack-cloud}
1768       - shell: |
1769           #!/bin/bash
1770           echo "Extract the image type for commit message"
1771           # echo IMAGE_TYPE=${{NEW_IMAGE_NAME% -*}} >> image-type.txt
1772           IMAGE_TYPE=$(echo ${{NEW_IMAGE_NAME}} | tr -d "\'\"\ " | awk -F- '{{ print $2 " " $3 " " $4 }}')
1773           echo IMAGE_TYPE=${{IMAGE_TYPE}} >> image-type.txt
1774           cat image-type.txt
1775       - inject:
1776           properties-file: "image-type.txt"
1777       - lf-infra-update-packer-images
1778       - lf-infra-push-gerrit-patch:
1779           project: "{project}"
1780           gerrit-user: "{gerrit-user}"
1781           gerrit-host: "{gerrit-host}"
1782           gerrit-topic: "{gerrit-topic}"
1783           gerrit-commit-message: "Update cloud image $IMAGE_TYPE"
1784           reviewers-email: "{reviewers-email}"
1785
1786     publishers:
1787       - lf-infra-publish
1788
1789 - job-template:
1790     name: "{project-name}-openstack-update-cloud-image"
1791     id: gerrit-openstack-update-cloud-image
1792     <<: *lf_openstack_update_cloud_image
1793
1794     ######################
1795     # Default parameters #
1796     ######################
1797
1798     git-url: "$GIT_URL/$GERRIT_PROJECT"
1799
1800     #####################
1801     # Job Configuration #
1802     #####################
1803
1804     scm:
1805       - lf-infra-gerrit-scm:
1806           git-url: "{git-url}"
1807           refspec: "$GERRIT_REFSPEC"
1808           branch: "$GERRIT_BRANCH"
1809           submodule-recursive: false
1810           submodule-timeout: "{submodule-timeout}"
1811           submodule-disable: "{submodule-disable}"
1812           choosing-strategy: gerrit
1813           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1814
1815     triggers:
1816       - timed: "{obj:cron}"
1817
1818 #################
1819 # Puppet Verify #
1820 #################
1821
1822 - lf_puppet_verify: &lf_puppet_verify
1823     name: lf-puppet-verify
1824
1825     ######################
1826     # Default parameters #
1827     ######################
1828
1829     branch: master
1830     build-days-to-keep: 7
1831     build-timeout: 15
1832     disable-job: false
1833     git-url: "$GIT_URL/$GERRIT_PROJECT"
1834     github-url: "https://github.com"
1835     parallel: true
1836     puppet-dir: ""
1837     puppet-lint-version: 2.3.6
1838     stream: master
1839     submodule-recursive: true
1840     submodule-timeout: 10
1841     submodule-disable: false
1842
1843     gerrit_trigger_file_paths:
1844       - compare-type: REG_EXP
1845         pattern: ".*"
1846
1847     # github_included_regions MUST match gerrit_trigger_file_paths
1848     github_included_regions:
1849       - ".*"
1850
1851     #####################
1852     # Job Configuration #
1853     #####################
1854
1855     project-type: freestyle
1856     node: "{build-node}"
1857     concurrent: true
1858     disabled: "{disable-job}"
1859
1860     properties:
1861       - lf-infra-properties:
1862           build-days-to-keep: "{build-days-to-keep}"
1863
1864     parameters:
1865       - lf-infra-parameters:
1866           project: "{project}"
1867           branch: "{branch}"
1868           stream: "{stream}"
1869       - lf-puppet-parameters:
1870           puppet-lint-version: "{puppet-lint-version}"
1871
1872     wrappers:
1873       - lf-infra-wrappers:
1874           build-timeout: "{build-timeout}"
1875           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1876
1877     builders:
1878       - shell: !include-raw-escape: ../shell/puppet-lint.sh
1879
1880     publishers:
1881       - lf-infra-publish
1882
1883 - job-template:
1884     name: "{project-name}-puppet-verify"
1885     id: gerrit-puppet-verify
1886     <<: *lf_puppet_verify
1887
1888     ######################
1889     # Default parameters #
1890     ######################
1891
1892     gerrit_verify_triggers:
1893       - patchset-created-event:
1894           exclude-drafts: true
1895           exclude-trivial-rebase: false
1896           exclude-no-code-change: false
1897       - draft-published-event
1898       - comment-added-contains-event:
1899           comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
1900
1901     #####################
1902     # Job Configuration #
1903     #####################
1904
1905     scm:
1906       - lf-infra-gerrit-scm:
1907           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1908           git-url: "{git-url}"
1909           refspec: "$GERRIT_REFSPEC"
1910           branch: "$GERRIT_BRANCH"
1911           submodule-recursive: "{submodule-recursive}"
1912           submodule-timeout: "{submodule-timeout}"
1913           submodule-disable: "{submodule-disable}"
1914           choosing-strategy: gerrit
1915
1916     triggers:
1917       - gerrit:
1918           server-name: "{gerrit-server-name}"
1919           trigger-on: "{obj:gerrit_verify_triggers}"
1920           projects:
1921             - project-compare-type: ANT
1922               project-pattern: "{project}"
1923               branches:
1924                 - branch-compare-type: ANT
1925                   branch-pattern: "**/{branch}"
1926               file-paths: "{obj:gerrit_trigger_file_paths}"
1927
1928 - job-template:
1929     name: "{project-name}-puppet-verify"
1930     id: github-puppet-verify
1931     <<: *lf_puppet_verify
1932
1933     #####################
1934     # Job Configuration #
1935     #####################
1936
1937     properties:
1938       - lf-infra-properties:
1939           project: "{project}"
1940           build-days-to-keep: 7
1941       - github:
1942           url: "{github-url}/{github-org}/{project}"
1943
1944     scm:
1945       - lf-infra-github-scm:
1946           url: "{git-clone-url}{github-org}/{project}"
1947           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
1948           branch: "$sha1"
1949           submodule-recursive: "{submodule-recursive}"
1950           submodule-timeout: "{submodule-timeout}"
1951           submodule-disable: "{submodule-disable}"
1952           choosing-strategy: default
1953           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1954
1955     triggers:
1956       - github-pull-request:
1957           trigger-phrase: "^(recheck|reverify)$"
1958           only-trigger-phrase: false
1959           status-context: "Puppet Verify"
1960           permit-all: true
1961           github-hooks: true
1962           included-regions: "{obj:github_included_regions}"
1963           white-list-target-branches:
1964             - "{branch}"
1965
1966 #########
1967 # Sonar #
1968 #########
1969
1970 - lf_sonar_common: &lf_sonar_common
1971     name: lf-sonar-common
1972
1973     ######################
1974     # Default parameters #
1975     ######################
1976
1977     archive-artifacts: >
1978       **/*.log
1979
1980     branch: master # Sonar should always be run on master branch
1981     build-days-to-keep: 7
1982     build-timeout: 60
1983     cron: "H H * * *" # run daily
1984     disable-job: false
1985     git-url: "$GIT_URL/$PROJECT"
1986     github-url: "https://github.com"
1987     stream: master
1988     submodule-recursive: true
1989     submodule-timeout: 10
1990     submodule-disable: false
1991
1992     # Sonar properties
1993     sonar-task: ""
1994     sonar-project-file: "sonar-project.properties"
1995     sonar-properties: ""
1996     sonar-java-opts: ""
1997     sonar-additional-args: ""
1998
1999     gerrit_trigger_file_paths:
2000       - compare-type: REG_EXP
2001         pattern: ".*"
2002
2003     # github_included_regions MUST match gerrit_trigger_file_paths
2004     github_included_regions:
2005       - ".*"
2006
2007     #####################
2008     # Job Configuration #
2009     #####################
2010
2011     project-type: freestyle
2012     node: "{build-node}"
2013
2014     properties:
2015       - lf-infra-properties:
2016           build-days-to-keep: "{build-days-to-keep}"
2017
2018     wrappers:
2019       - lf-infra-wrappers:
2020           build-timeout: "{build-timeout}"
2021           jenkins-ssh-credential: "{jenkins-ssh-credential}"
2022
2023     disabled: "{disable-job}"
2024
2025     parameters:
2026       - lf-infra-parameters:
2027           project: "{project}"
2028           branch: "{branch}"
2029           stream: "{stream}"
2030       - string:
2031           name: ARCHIVE_ARTIFACTS
2032           default: "{archive-artifacts}"
2033           description: Artifacts to archive to the logs server.
2034
2035     publishers:
2036       - lf-infra-publish
2037
2038 - lf_sonar_builders: &lf_sonar_builders
2039     name: lf-sonar-builders
2040     builders:
2041       - lf-infra-pre-build
2042       - lf-infra-sonar:
2043           sonar-task: "{sonar-task}"
2044           sonar-project-file: "{sonar-project-file}"
2045           sonar-properties: "{sonar-properties}"
2046           sonar-java-opts: "{sonar-java-opts}"
2047           sonar-additional-args: "{sonar-additional-args}"
2048
2049 - lf_sonar_builders_prescan: &lf_sonar_builders_prescan
2050     name: lf-sonar-builders-prescan
2051     builders:
2052       - lf-infra-pre-build
2053       - lf-infra-sonar-with-prescan:
2054           sonar-task: "{sonar-task}"
2055           sonar-project-file: "{sonar-project-file}"
2056           sonar-properties: "{sonar-properties}"
2057           sonar-java-opts: "{sonar-java-opts}"
2058           sonar-additional-args: "{sonar-additional-args}"
2059
2060 - lf_sonar_gerrit_common: &lf_sonar_gerrit_common
2061     name: lf-sonar-gerrit-common
2062     gerrit_sonar_triggers:
2063       - comment-added-contains-event:
2064           comment-contains-value: '^Patch Set\s+\d+:\s+run-sonar\s*$'
2065
2066     scm:
2067       - lf-infra-gerrit-scm:
2068           jenkins-ssh-credential: "{jenkins-ssh-credential}"
2069           git-url: "{git-url}"
2070           refspec: $GERRIT_REFSPEC
2071           branch: $GERRIT_BRANCH
2072           submodule-recursive: "{submodule-recursive}"
2073           submodule-timeout: "{submodule-timeout}"
2074           submodule-disable: "{submodule-disable}"
2075           choosing-strategy: default
2076
2077     triggers:
2078       - timed: "{obj:cron}"
2079       - gerrit:
2080           server-name: "{gerrit-server-name}"
2081           trigger-on: "{obj:gerrit_sonar_triggers}"
2082           projects:
2083             - project-compare-type: "ANT"
2084               project-pattern: "{project}"
2085               branches:
2086                 - branch-compare-type: "ANT"
2087                   branch-pattern: "**/{branch}"
2088               file-paths: "{obj:gerrit_trigger_file_paths}"
2089           skip-vote:
2090             successful: true
2091             failed: true
2092             unstable: true
2093             notbuilt: true
2094
2095 - lf_sonar_github_common: &lf_sonar_github_common
2096     name: lf-sonar-github-common
2097     properties:
2098       - lf-infra-properties:
2099           build-days-to-keep: "{build-days-to-keep}"
2100       - github:
2101           url: "{github-url}/{github-org}/{project}"
2102
2103     scm:
2104       - lf-infra-github-scm:
2105           url: "{git-clone-url}{github-org}/{project}"
2106           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
2107           branch: "$sha1"
2108           submodule-recursive: "{submodule-recursive}"
2109           submodule-timeout: "{submodule-timeout}"
2110           submodule-disable: "{submodule-disable}"
2111           choosing-strategy: default
2112           jenkins-ssh-credential: "{jenkins-ssh-credential}"
2113
2114     triggers:
2115       - github-pull-request:
2116           trigger-phrase: "^run-sonar$"
2117           only-trigger-phrase: false
2118           status-context: "Python Sonar"
2119           permit-all: true
2120           github-hooks: true
2121           white-list-target-branches:
2122             - "{branch}"
2123           included-regions: "{obj:github_included_regions}"
2124
2125 - job-template:
2126     name: "{project-name}-sonar"
2127     id: gerrit-sonar
2128     <<: *lf_sonar_common
2129     # yamllint disable-line rule:key-duplicates
2130     <<: *lf_sonar_builders
2131     # yamllint disable-line rule:key-duplicates
2132     <<: *lf_sonar_gerrit_common
2133
2134 - job-template:
2135     name: "{project-name}-sonar"
2136     id: github-sonar
2137     <<: *lf_sonar_common
2138     # yamllint disable-line rule:key-duplicates
2139     <<: *lf_sonar_builders
2140     # yamllint disable-line rule:key-duplicates
2141     <<: *lf_sonar_github_common
2142
2143 - job-template:
2144     name: "{project-name}-sonar-prescan"
2145     id: gerrit-sonar-prescan
2146     <<: *lf_sonar_common
2147     # yamllint disable-line rule:key-duplicates
2148     <<: *lf_sonar_builders_prescan
2149     # yamllint disable-line rule:key-duplicates
2150     <<: *lf_sonar_gerrit_common
2151
2152 - job-template:
2153     name: "{project-name}-sonar-prescan"
2154     id: github-sonar-prescan
2155     <<: *lf_sonar_common
2156     # yamllint disable-line rule:key-duplicates
2157     <<: *lf_sonar_builders_prescan
2158     # yamllint disable-line rule:key-duplicates
2159     <<: *lf_sonar_github_common