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