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