Add support for Sonar pre-scan shell script
[releng/global-jjb.git] / jjb / lf-ci-jobs.yaml
1 ---
2 ####################
3 # COMMON FUNCTIONS #
4 ####################
5
6 - builder:
7     name: lf-infra-jjbini
8     builders:
9       - config-file-provider:
10           files:
11             - file-id: jjbini
12               target: "$HOME/.config/jenkins_jobs/jenkins_jobs.ini"
13
14 - lf_packer: &lf_packer_common
15     name: lf-packer-common
16     # Provide configuration common in packer jobs.
17
18     ######################
19     # Default parameters #
20     ######################
21
22     branch: master
23     build-timeout: 90
24     cron: "@monthly"
25     disable-job: false
26     github-url: "https://github.com"
27     stream: master
28     submodule-recursive: true
29     submodule-timeout: 10
30     submodule-disable: false
31     packer-cloud-settings: packer-cloud-env
32     packer-version: 1.4.2
33
34     #####################
35     # Job Configuration #
36     #####################
37
38     project-type: freestyle
39     node: "{build-node}"
40     disabled: "{disable-job}"
41
42     properties:
43       - lf-infra-properties:
44           project: "{project}"
45           build-days-to-keep: 7
46
47     parameters:
48       - lf-infra-parameters:
49           project: "{project}"
50           stream: "{stream}"
51           branch: "{branch}"
52       - lf-packer-parameters:
53           packer-version: "{packer-version}"
54
55     wrappers:
56       - lf-infra-wrappers:
57           build-timeout: "{build-timeout}"
58           jenkins-ssh-credential: "{jenkins-ssh-credential}"
59
60     publishers:
61       - lf-infra-publish
62
63 - parameter:
64     name: lf-infra-jjb-parameters
65     parameters:
66       - string:
67           name: JJB_VERSION
68           default: "{jjb-version}"
69           description: Jenkins Job Builder version to download and install.
70       - string:
71           name: XDG_CACHE_HOME
72           default: "{jjb-cache}"
73           description: Jenkins Job Builder cache location.
74
75 - parameter:
76     name: lf-packer-parameters
77     parameters:
78       - string:
79           name: PACKER_VERSION
80           default: "{packer-version}"
81           description: Packer version to download and install.
82
83 - parameter:
84     name: lf-puppet-parameters
85     parameters:
86       - string:
87           name: PUPPET_LINT_VERSION
88           default: "{puppet-lint-version}"
89           description: Puppet-lint version to download and install.
90
91 - lf_jjb_common: &lf_jjb_common
92     name: lf-jjb-common
93
94     ######################
95     # Default parameters #
96     ######################
97
98     branch: master
99     build-timeout: 10
100     disable-job: false
101     github-url: "https://github.com"
102     jjb-cache: "$HOME/.cache/jenkins_jobs"
103     jjb-version: 2.8.0
104     stream: master
105     submodule-recursive: true
106     submodule-timeout: 10
107     submodule-disable: false
108     throttle_categories: []
109     throttle-enabled: false
110     throttle-max-per-node: 1
111     throttle-max-total: 0
112     throttle-option: "project"
113
114     gerrit_trigger_file_paths:
115       - compare-type: REG_EXP
116         pattern: "jjb/.*"
117       - compare-type: REG_EXP
118         pattern: "global-jjb"
119       - compare-type: REG_EXP
120         pattern: "shell/.*"
121
122     # github_included_regions MUST match gerrit_trigger_file_paths
123     github_included_regions:
124       - "jjb/.*"
125       - "global-jjb"
126       - "shell/.*"
127
128     #####################
129     # Job Configuration #
130     #####################
131
132     project-type: freestyle
133     node: "{build-node}"
134     disabled: "{disable-job}"
135
136     properties:
137       - lf-infra-properties:
138           project: "{project}"
139           build-days-to-keep: 7
140       - throttle:
141           categories: "{obj:throttle_categories}"
142           enabled: "{throttle-enabled}"
143           max-per-node: "{throttle-max-per-node}"
144           max-total: "{throttle-max-total}"
145           option: "{throttle-option}"
146
147     parameters:
148       - lf-infra-parameters:
149           project: "{project}"
150           stream: "{stream}"
151           branch: "{branch}"
152       - lf-infra-jjb-parameters:
153           jjb-cache: "{jjb-cache}"
154           jjb-version: "{jjb-version}"
155
156     wrappers:
157       - lf-infra-wrappers:
158           build-timeout: "{build-timeout}"
159           jenkins-ssh-credential: "{jenkins-ssh-credential}"
160
161     publishers:
162       - lf-infra-publish
163
164 ######################
165 # Gerrit Branch Lock #
166 ######################
167
168 - job-template:
169     name: "{project-name}-gerrit-branch-lock"
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
826     gerrit_verify_triggers:
827       - patchset-created-event:
828           exclude-drafts: true
829           exclude-trivial-rebase: false
830           exclude-no-code-change: false
831       - draft-published-event
832       - comment-added-contains-event:
833           comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
834
835     #####################
836     # Job Configuration #
837     #####################
838
839     concurrent: "{build-concurrent}"
840
841     builders:
842       - lf-infra-pre-build
843       - lf-infra-jjbini
844       - shell: !include-raw-escape:
845           - ../shell/jjb-verify-job.sh
846       - lf-infra-gpg-verify-git-signature
847
848 - job-template:
849     name: "{project-name}-jjb-verify"
850     id: gerrit-jjb-verify
851     <<: *lf_jjb_common
852     # yamllint disable-line rule:key-duplicates
853     <<: *lf_jjb_verify
854
855     ######################
856     # Default parameters #
857     ######################
858
859     git-url: "$GIT_URL/$GERRIT_PROJECT"
860
861     #####################
862     # Job Configuration #
863     #####################
864
865     scm:
866       - lf-infra-gerrit-scm:
867           git-url: "{git-url}"
868           refspec: "$GERRIT_REFSPEC"
869           branch: "$GERRIT_BRANCH"
870           submodule-recursive: "{submodule-recursive}"
871           submodule-timeout: "{submodule-timeout}"
872           submodule-disable: "{submodule-disable}"
873           choosing-strategy: gerrit
874           jenkins-ssh-credential: "{jenkins-ssh-credential}"
875
876     triggers:
877       - gerrit:
878           server-name: "{gerrit-server-name}"
879           trigger-on: "{obj:gerrit_verify_triggers}"
880           projects:
881             - project-compare-type: ANT
882               project-pattern: "{project}"
883               branches:
884                 - branch-compare-type: ANT
885                   branch-pattern: "**/{branch}"
886               file-paths: "{obj:gerrit_trigger_file_paths}"
887
888 - job-template:
889     name: "{project-name}-jjb-verify"
890     id: github-jjb-verify
891     <<: *lf_jjb_common
892     # yamllint disable-line rule:key-duplicates
893     <<: *lf_jjb_verify
894
895     #####################
896     # Job Configuration #
897     #####################
898
899     properties:
900       - lf-infra-properties:
901           project: "{project}"
902           build-days-to-keep: 7
903       - github:
904           url: "{github-url}/{github-org}/{project}"
905
906     scm:
907       - lf-infra-github-scm:
908           url: "{git-clone-url}{github-org}/{project}"
909           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
910           branch: "$sha1"
911           submodule-recursive: "{submodule-recursive}"
912           submodule-timeout: "{submodule-timeout}"
913           submodule-disable: "{submodule-disable}"
914           choosing-strategy: default
915           jenkins-ssh-credential: "{jenkins-ssh-credential}"
916
917     triggers:
918       - github-pull-request:
919           trigger-phrase: "^(recheck|reverify)$"
920           only-trigger-phrase: false
921           status-context: "JJB Verify"
922           permit-all: true
923           github-hooks: true
924           included-regions: "{obj:github_included_regions}"
925           white-list-target-branches:
926             - "{branch}"
927
928 ############################
929 # JJB Verify Upstream GJJB #
930 ############################
931
932 - lf_jjb_verify: &lf_jjb_verify_upstream_gjjb
933     name: lf-jjb-verify-upstream-gjjb
934
935     #####################
936     # Job Configuration #
937     #####################
938
939     concurrent: true
940
941     builders:
942       - shell: |
943           cd global-jjb
944           git fetch https://gerrit.linuxfoundation.org/infra/releng/global-jjb $GERRIT_REFSPEC
945           git cherry-pick FETCH_HEAD
946       - lf-infra-jjbini
947       - shell: !include-raw-escape:
948           - ../shell/jjb-verify-job.sh
949       - lf-infra-gpg-verify-git-signature
950
951 - job-template:
952     name: "{project-name}-jjb-verify-upstream-gjjb"
953     id: gerrit-jjb-verify-upstream-gjjb
954     <<: *lf_jjb_common
955     # yamllint disable-line rule:key-duplicates
956     <<: *lf_jjb_verify_upstream_gjjb
957
958     ######################
959     # Default parameters #
960     ######################
961
962     git-url: "$GIT_URL/$PROJECT"
963     submodule-timeout: 10
964     submodule-disable: false
965
966     #####################
967     # Job Configuration #
968     #####################
969
970     scm:
971       - lf-infra-gerrit-scm:
972           git-url: "{git-url}"
973           refspec: ""
974           branch: "master"
975           submodule-recursive: true
976           submodule-timeout: "{submodule-timeout}"
977           submodule-disable: "{submodule-disable}"
978           choosing-strategy: default
979           jenkins-ssh-credential: "{jenkins-ssh-credential}"
980
981     triggers:
982       - gerrit:
983           server-name: "LinuxFoundation"
984           trigger-on:
985             - patchset-created-event:
986                 exclude-drafts: true
987                 exclude-trivial-rebase: false
988                 exclude-no-code-change: false
989             - draft-published-event
990             - comment-added-contains-event:
991                 comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
992           projects:
993             - project-compare-type: ANT
994               project-pattern: "releng/global-jjb"
995               branches:
996                 - branch-compare-type: ANT
997                   branch-pattern: "**/master"
998           override-votes: true
999           gerrit-build-failed-codereview-value: -1
1000           gerrit-build-failed-verified-value: 0
1001           gerrit-build-successful-codereview-value: 1
1002           gerrit-build-successful-verified-value: 0
1003
1004 #################
1005 # License Check #
1006 #################
1007
1008 - lf_license_check: &lf_license_check
1009     name: lf-license-check
1010
1011     ######################
1012     # Default parameters #
1013     ######################
1014
1015     branch: master
1016     build-days-to-keep: 7
1017     build-timeout: 15
1018     disable-job: false
1019     file-patterns: >
1020       *.go
1021       *.groovy
1022       *.java
1023       *.py
1024       *.sh
1025     git-url: "$GIT_URL/$PROJECT"
1026     github-url: "https://github.com"
1027     lhc-version: 0.2.0
1028     license-exclude-paths: ""
1029     licenses-allowed: Apache-2.0,EPL-1.0,MIT
1030     project-pattern: "**"
1031     spdx-disable: false
1032     stream: master
1033     submodule-timeout: 10
1034     submodule-disable: false
1035
1036     #####################
1037     # Job Configuration #
1038     #####################
1039
1040     project-type: freestyle
1041     node: "{build-node}"
1042     concurrent: true
1043     disabled: "{disable-job}"
1044
1045     properties:
1046       - lf-infra-properties:
1047           build-days-to-keep: "{build-days-to-keep}"
1048
1049     parameters:
1050       - lf-infra-parameters:
1051           project: "{project}"
1052           branch: "{branch}"
1053           stream: "{stream}"
1054
1055     wrappers:
1056       - lf-infra-wrappers:
1057           build-timeout: "{build-timeout}"
1058           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1059
1060     builders:
1061       - lf-license-check:
1062           file-patterns: "{file-patterns}"
1063           spdx-disable: "{spdx-disable}"
1064           lhc-version: "{lhc-version}"
1065           license-exclude-paths: "{license-exclude-paths}"
1066           licenses-allowed: "{licenses-allowed}"
1067
1068     publishers:
1069       - lf-infra-publish
1070
1071 - job-template:
1072     name: "{project-name}-license-check"
1073     id: gerrit-license-check
1074     <<: *lf_license_check
1075
1076     git-url: "$GIT_URL/$GERRIT_PROJECT"
1077
1078     scm:
1079       - lf-infra-gerrit-scm:
1080           git-url: "{git-url}"
1081           refspec: "$GERRIT_REFSPEC"
1082           branch: "$GERRIT_BRANCH"
1083           # Submodules are out of the project's control
1084           submodule-recursive: false
1085           submodule-timeout: "{submodule-timeout}"
1086           submodule-disable: "{submodule-disable}"
1087           choosing-strategy: gerrit
1088           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1089
1090     triggers:
1091       - gerrit:
1092           server-name: "{gerrit-server-name}"
1093           # Trigger should not be overridable as we want to always run
1094           trigger-on:
1095             - patchset-created-event:
1096                 exclude-drafts: false
1097                 exclude-trivial-rebase: false
1098                 exclude-no-code-change: false
1099             - draft-published-event
1100             - comment-added-contains-event:
1101                 comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
1102           projects:
1103             - project-compare-type: ANT
1104               project-pattern: "{project-pattern}"
1105               branches:
1106                 - branch-compare-type: ANT
1107                   branch-pattern: "**"
1108
1109 - job-template:
1110     name: "{project-name}-license-check"
1111     id: github-license-check
1112     <<: *lf_license_check
1113
1114     properties:
1115       - lf-infra-properties:
1116           build-days-to-keep: "{build-days-to-keep}"
1117       - github:
1118           url: "{github-url}/{github-org}/{project}"
1119
1120     scm:
1121       - lf-infra-github-scm:
1122           url: "{git-clone-url}{github-org}/{project}"
1123           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
1124           branch: "$sha1"
1125           # Submodules are out of the project's control
1126           submodule-recursive: false
1127           submodule-timeout: "{submodule-timeout}"
1128           submodule-disable: "{submodule-disable}"
1129           choosing-strategy: default
1130           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1131
1132     triggers:
1133       - github-pull-request:
1134           trigger-phrase: "^recheck$"
1135           only-trigger-phrase: false
1136           status-context: "License Check"
1137           permit-all: true
1138           github-hooks: true
1139           white-list-target-branches:
1140             - "{branch}"
1141
1142 ####################
1143 # Info YAML Verify #
1144 ####################
1145
1146 - lf_info_yaml_verify: &lf_info_yaml_verify
1147     name: lf-info-yaml-verify
1148
1149     ######################
1150     # Default parameters #
1151     ######################
1152
1153     gerrit_verify_triggers:
1154       - patchset-created-event:
1155           exclude-drafts: true
1156           exclude-trivial-rebase: false
1157           exclude-no-code-change: false
1158       - draft-published-event
1159       - comment-added-contains-event:
1160           comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
1161
1162     #####################
1163     # Job Configuration #
1164     #####################
1165
1166     concurrent: true
1167
1168     builders:
1169       - shell: !include-raw-escape:
1170           - ../shell/git-validate-info-yaml.sh
1171           - ../shell/info-file-validate.sh
1172
1173 - job-template:
1174     name: "{project-name}-info-yaml-verify"
1175     id: gerrit-info-yaml-verify
1176     <<: *lf_jjb_common
1177     # yamllint disable-line rule:key-duplicates
1178     <<: *lf_info_yaml_verify
1179
1180     git-url: "$GIT_URL/$GERRIT_PROJECT"
1181
1182     scm:
1183       - lf-infra-gerrit-scm:
1184           git-url: "{git-url}"
1185           refspec: "$GERRIT_REFSPEC"
1186           branch: "$GERRIT_BRANCH"
1187           submodule-recursive: "{submodule-recursive}"
1188           submodule-timeout: "{submodule-timeout}"
1189           submodule-disable: "{submodule-disable}"
1190           choosing-strategy: gerrit
1191           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1192
1193     triggers:
1194       - gerrit:
1195           server-name: "{gerrit-server-name}"
1196           trigger-on: "{obj:gerrit_verify_triggers}"
1197           projects:
1198             - project-compare-type: ANT
1199               project-pattern: "{project}"
1200               branches:
1201                 - branch-compare-type: ANT
1202                   branch-pattern: "**/{branch}"
1203               file-paths:
1204                 - compare-type: REG_EXP
1205                   pattern: "INFO.yaml"
1206
1207 - job-template:
1208     name: "{project-name}-info-yaml-verify"
1209     id: github-info-yaml-verify
1210     <<: *lf_jjb_common
1211     # yamllint disable-line rule:key-duplicates
1212     <<: *lf_info_yaml_verify
1213
1214     github-url: "https://github.com"
1215     properties:
1216       - github:
1217           url: "{github-url}/{github-org}/{project}"
1218
1219     scm:
1220       - lf-infra-github-scm:
1221           url: "{git-clone-url}{github-org}/{project}"
1222           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
1223           branch: "$sha1"
1224           submodule-recursive: "{submodule-recursive}"
1225           submodule-timeout: "{submodule-timeout}"
1226           submodule-disable: "{submodule-disable}"
1227           choosing-strategy: default
1228           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1229
1230     triggers:
1231       - github-pull-request:
1232           trigger-phrase: "^(recheck|reverify)$"
1233           only-trigger-phrase: false
1234           status-context: "INFO File Verify"
1235           permit-all: true
1236           github-hooks: true
1237           # included-regions MUST match gerrit file-paths
1238           included-regions: "INFO.yaml"
1239           white-list-target-branches:
1240             - "{branch}"
1241
1242 ##################
1243 # OPENSTACK CRON #
1244 ##################
1245
1246 - lf_openstack_cron: &lf_openstack_cron
1247     name: lf-openstack-cron
1248
1249     ######################
1250     # Default parameters #
1251     ######################
1252
1253     branch: master
1254     build-days-to-keep: 7
1255     build-timeout: 10
1256     cron: "@hourly"
1257     disable-job: false
1258     git-url: "$GIT_URL/$PROJECT"
1259     github-url: "https://github.com"
1260     openstack-cloud: vex
1261     openstack-image-cleanup: true
1262     openstack-image-cleanup-age: 30
1263     openstack-image-protect: true
1264     openstack-port-cleanup: true
1265     openstack-server-cleanup: true
1266     openstack-stack-cleanup: true
1267     openstack-volume-cleanup: true
1268     stream: master
1269     submodule-timeout: 10
1270     submodule-disable: false
1271
1272     #####################
1273     # Job Configuration #
1274     #####################
1275
1276     project-type: freestyle
1277     node: "{build-node}"
1278     concurrent: false
1279     disabled: "{disable-job}"
1280
1281     properties:
1282       - lf-infra-properties:
1283           build-days-to-keep: "{build-days-to-keep}"
1284
1285     parameters:
1286       - lf-infra-parameters:
1287           project: "{project}"
1288           stream: "{stream}"
1289           branch: "{branch}"
1290       - string:
1291           name: JENKINS_URLS
1292           default: "{jenkins-urls}"
1293           description: |
1294             Space separated list of Jenkins URLs to check for active builds.
1295
1296     wrappers:
1297       - lf-infra-wrappers:
1298           build-timeout: "{build-timeout}"
1299           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1300       # Listed after to override openstack-infra-wrappers clouds.yaml definition
1301       - config-file-provider:
1302           files:
1303             - file-id: clouds-yaml
1304               target: "$HOME/.config/openstack/clouds.yaml"
1305             - file-id: npmrc
1306               target: "$HOME/.npmrc"
1307             - file-id: pipconf
1308               target: "$HOME/.config/pip/pip.conf"
1309
1310     triggers:
1311       - timed: "{obj:cron}"
1312
1313     builders:
1314       - lf-infra-pre-build
1315       - inject:
1316           properties-content: OS_CLOUD={openstack-cloud}
1317       # Stacks
1318       - conditional-step:
1319           condition-kind: boolean-expression
1320           condition-expression: "{openstack-stack-cleanup}"
1321           steps:
1322             - shell: !include-raw-escape: ../shell/openstack-cleanup-orphaned-stacks.sh
1323       # Servers
1324       - conditional-step:
1325           condition-kind: boolean-expression
1326           condition-expression: "{openstack-server-cleanup}"
1327           steps:
1328             - shell: !include-raw-escape: ../shell/openstack-cleanup-orphaned-servers.sh
1329       # Ports
1330       - conditional-step:
1331           condition-kind: boolean-expression
1332           condition-expression: "{openstack-port-cleanup}"
1333           steps:
1334             - shell: !include-raw-escape: ../shell/openstack-cleanup-orphaned-ports.sh
1335       # Volumes
1336       - conditional-step:
1337           condition-kind: boolean-expression
1338           condition-expression: "{openstack-volume-cleanup}"
1339           steps:
1340             - shell: !include-raw-escape: ../shell/openstack-cleanup-orphaned-volumes.sh
1341       # Images
1342       - conditional-step:
1343           condition-kind: boolean-expression
1344           condition-expression: "{openstack-image-protect}"
1345           steps:
1346             - shell: !include-raw-escape: ../shell/openstack-protect-in-use-images.sh
1347       - conditional-step:
1348           condition-kind: boolean-expression
1349           condition-expression: "{openstack-image-cleanup}"
1350           steps:
1351             - inject:
1352                 properties-content: OS_IMAGE_CLEANUP_AGE={openstack-image-cleanup-age}
1353             - shell: !include-raw-escape: ../shell/openstack-cleanup-old-images.sh
1354
1355     publishers:
1356       - lf-infra-publish
1357
1358 - job-template:
1359     name: "{project-name}-openstack-cron"
1360     id: gerrit-openstack-cron
1361     <<: *lf_openstack_cron
1362
1363     scm:
1364       - lf-infra-gerrit-scm:
1365           git-url: "{git-url}"
1366           refspec: "refs/heads/{branch}"
1367           branch: "{branch}"
1368           submodule-recursive: true
1369           submodule-timeout: "{submodule-timeout}"
1370           submodule-disable: "{submodule-disable}"
1371           choosing-strategy: default
1372           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1373
1374 - job-template:
1375     name: "{project-name}-openstack-cron"
1376     id: github-openstack-cron
1377     <<: *lf_openstack_cron
1378
1379     scm:
1380       - lf-infra-github-scm:
1381           url: "{git-clone-url}{github-org}/{project}"
1382           refspec: ""
1383           branch: "refs/heads/{branch}"
1384           submodule-recursive: true
1385           submodule-timeout: "{submodule-timeout}"
1386           submodule-disable: "{submodule-disable}"
1387           choosing-strategy: default
1388           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1389
1390 ################
1391 # Packer Merge #
1392 ################
1393
1394 - lf_packer_merge: &lf_packer_merge
1395     name: lf-packer-merge
1396
1397     ######################
1398     # Default parameters #
1399     ######################
1400
1401     openstack: true
1402     openstack-cloud: vex
1403     update-cloud-image: false
1404
1405     #####################
1406     # Job Configuration #
1407     #####################
1408
1409     parameters:
1410       - lf-infra-parameters:
1411           project: "{project}"
1412           stream: "{stream}"
1413           branch: "{branch}"
1414       - lf-packer-parameters:
1415           packer-version: "{packer-version}"
1416       - bool:
1417           name: UPDATE_CLOUD_IMAGE
1418           default: "{update-cloud-image}"
1419           description: "Update new built image on the cloud."
1420
1421     builders:
1422       - lf-infra-packer-build:
1423           openstack: "{openstack}"
1424           openstack-cloud: "{openstack-cloud}"
1425           packer-cloud-settings: "{packer-cloud-settings}"
1426           packer-version: "{packer-version}"
1427           platform: "{platforms}"
1428           template: "{templates}"
1429           update-cloud-image: "{update-cloud-image}"
1430       - description-setter:
1431           regexp: '(\s+.*)(ZZCI\s+.*\d+-\d+\.\d+)'
1432           description: 'Image: \2'
1433       # - trigger-builds:
1434       #     - project: '{project-name}-openstack-update-cloud-image'
1435       #       block: false
1436       #       predefined-parameters: |
1437       #         GERRIT_BRANCH=$GERRIT_BRANCH
1438       #         GERRIT_PROJECT=$GERRIT_PROJECT
1439       #         GERRIT_REFSPEC=$GERRIT_REFSPEC
1440       #         NEW_IMAGE_NAME=$NEW_IMAGE_NAME
1441       #       property-file: variables.jenkins-trigger
1442       #       property-file-fail-on-missing: true
1443
1444     publishers:
1445       - lf-infra-publish
1446       - trigger-parameterized-builds:
1447           - project: "{project-name}-openstack-update-cloud-image"
1448             condition: UNSTABLE_OR_BETTER
1449             predefined-parameters: |
1450               NEW_IMAGE_NAME=$NEW_IMAGE_NAME
1451             property-file: variables.jenkins-trigger
1452             fail-on-missing: true
1453
1454 - job-template:
1455     name: "{project-name}-packer-merge-{platforms}-{templates}"
1456     id: gerrit-packer-merge
1457     <<: *lf_packer_common
1458     # yamllint disable-line rule:key-duplicates
1459     <<: *lf_packer_merge
1460
1461     ######################
1462     # Default parameters #
1463     ######################
1464
1465     git-url: "$GIT_URL/$GERRIT_PROJECT"
1466
1467     gerrit_merge_triggers:
1468       - change-merged-event
1469       - comment-added-contains-event:
1470           comment-contains-value: '^Patch Set\s+\d+:\s+remerge\s*$'
1471
1472     #####################
1473     # Job Configuration #
1474     #####################
1475
1476     scm:
1477       - lf-infra-gerrit-scm:
1478           git-url: "{git-url}"
1479           refspec: "$GERRIT_REFSPEC"
1480           branch: "$GERRIT_BRANCH"
1481           submodule-recursive: "{submodule-recursive}"
1482           submodule-timeout: "{submodule-timeout}"
1483           submodule-disable: "{submodule-disable}"
1484           choosing-strategy: default
1485           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1486
1487     triggers:
1488       - timed: "{obj:cron}"
1489       - gerrit:
1490           server-name: "{gerrit-server-name}"
1491           trigger-on: "{obj:gerrit_merge_triggers}"
1492           projects:
1493             - project-compare-type: ANT
1494               project-pattern: "{project}"
1495               branches:
1496                 - branch-compare-type: ANT
1497                   branch-pattern: "**/{branch}"
1498               file-paths:
1499                 - compare-type: REG_EXP
1500                   pattern: 'packer\/provision\/.*\.sh'
1501                 - compare-type: REG_EXP
1502                   pattern: 'packer\/provision\/.*\.bat'
1503                 - compare-type: REG_EXP
1504                   pattern: 'packer\/provision\/.*\.ps1'
1505                 - compare-type: REG_EXP
1506                   pattern: 'packer\/provision\/{templates}\.yaml'
1507                 - compare-type: REG_EXP
1508                   pattern: 'packer\/provision\/local-{templates}\.yaml'
1509                 - compare-type: REG_EXP
1510                   pattern: 'packer\/templates\/{templates}\.json'
1511                 - compare-type: REG_EXP
1512                   pattern: 'packer\/vars\/{platforms}\.json'
1513
1514 - job-template:
1515     name: "{project-name}-packer-merge-{platforms}-{templates}"
1516     id: github-packer-merge
1517     <<: *lf_packer_common
1518     # yamllint disable-line rule:key-duplicates
1519     <<: *lf_packer_merge
1520
1521     #####################
1522     # Job Configuration #
1523     #####################
1524
1525     properties:
1526       - lf-infra-properties:
1527           project: "{project}"
1528           build-days-to-keep: 7
1529       - github:
1530           url: "{github-url}/{github-org}/{project}"
1531
1532     scm:
1533       - lf-infra-github-scm:
1534           url: "{git-clone-url}{github-org}/{project}"
1535           refspec: >
1536             +refs/heads/*:refs/remotes/origin/*
1537             +refs/pull/*:refs/remotes/origin/pr/*
1538           branch: "$GERRIT_REFSPEC"
1539           submodule-recursive: "{submodule-recursive}"
1540           submodule-timeout: "{submodule-timeout}"
1541           submodule-disable: "{submodule-disable}"
1542           choosing-strategy: default
1543           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1544
1545     triggers:
1546       - timed: "{obj:cron}"
1547       - github
1548       - pollscm:
1549           cron: ""
1550
1551       - github-pull-request:
1552           trigger-phrase: "^remerge$"
1553           only-trigger-phrase: true
1554           status-context: "Packer {platforms}-{templates} Merge"
1555           permit-all: true
1556           github-hooks: true
1557           org-list:
1558             - "{github-org}"
1559           white-list: "{obj:github_pr_whitelist}"
1560           admin-list: "{obj:github_pr_admin_list}"
1561           # included-regions MUST match Gerrit Trigger file-paths
1562           included-regions:
1563             - 'packer\/provision\/.*\.sh'
1564             - 'packer\/provision\/.*\.bat'
1565             - 'packer\/provision\/.*\.ps1'
1566             - 'packer\/provision\/{templates}\.yaml'
1567             - 'packer\/provision\/local-{templates}\.yaml'
1568             - 'packer\/templates\/{templates}\.json'
1569             - 'packer\/vars\/{platforms}\.json'
1570           white-list-target-branches:
1571             - "{branch}"
1572
1573 #################
1574 # Packer Verify #
1575 #################
1576
1577 - lf_packer_verify: &lf_packer_verify
1578     name: lf-packer-verify
1579
1580     ######################
1581     # Default parameters #
1582     ######################
1583
1584     build-timeout: 10
1585     openstack: true
1586     openstack-cloud: vex
1587
1588     gerrit_verify_triggers:
1589       - patchset-created-event:
1590           exclude-drafts: true
1591           exclude-trivial-rebase: false
1592           exclude-no-code-change: false
1593       - draft-published-event
1594       - comment-added-contains-event:
1595           comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
1596
1597     gerrit_trigger_file_paths:
1598       - compare-type: REG_EXP
1599         pattern: 'packer\/.*'
1600
1601     # github_included_regions MUST match gerrit_trigger_file_paths
1602     github_included_regions:
1603       - 'packer\/.*'
1604
1605     #####################
1606     # Job Configuration #
1607     #####################
1608
1609     concurrent: true
1610
1611     builders:
1612       - lf-infra-packer-validate:
1613           openstack: "{openstack}"
1614           openstack-cloud: "{openstack-cloud}"
1615           packer-cloud-settings: "{packer-cloud-settings}"
1616           packer-version: "{packer-version}"
1617
1618 - job-template:
1619     name: "{project-name}-packer-verify"
1620     id: gerrit-packer-verify
1621     <<: *lf_packer_common
1622     # yamllint disable-line rule:key-duplicates
1623     <<: *lf_packer_verify
1624
1625     ######################
1626     # Default parameters #
1627     ######################
1628
1629     git-url: "$GIT_URL/$GERRIT_PROJECT"
1630
1631     #####################
1632     # Job Configuration #
1633     #####################
1634
1635     scm:
1636       - lf-infra-gerrit-scm:
1637           git-url: "{git-url}"
1638           refspec: "$GERRIT_REFSPEC"
1639           branch: "$GERRIT_BRANCH"
1640           submodule-recursive: "{submodule-recursive}"
1641           submodule-timeout: "{submodule-timeout}"
1642           submodule-disable: "{submodule-disable}"
1643           choosing-strategy: gerrit
1644           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1645
1646     triggers:
1647       - gerrit:
1648           server-name: "{gerrit-server-name}"
1649           trigger-on: "{obj:gerrit_verify_triggers}"
1650           projects:
1651             - project-compare-type: ANT
1652               project-pattern: "{project}"
1653               branches:
1654                 - branch-compare-type: ANT
1655                   branch-pattern: "**/{branch}"
1656               file-paths: "{obj:gerrit_trigger_file_paths}"
1657
1658 - job-template:
1659     name: "{project-name}-packer-verify"
1660     id: github-packer-verify
1661     <<: *lf_packer_common
1662     # yamllint disable-line rule:key-duplicates
1663     <<: *lf_packer_verify
1664
1665     #####################
1666     # Job Configuration #
1667     #####################
1668
1669     properties:
1670       - lf-infra-properties:
1671           project: "{project}"
1672           build-days-to-keep: 7
1673       - github:
1674           url: "{github-url}/{github-org}/{project}"
1675
1676     scm:
1677       - lf-infra-github-scm:
1678           url: "{git-clone-url}{github-org}/{project}"
1679           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
1680           branch: "$sha1"
1681           submodule-recursive: "{submodule-recursive}"
1682           submodule-timeout: "{submodule-timeout}"
1683           submodule-disable: "{submodule-disable}"
1684           choosing-strategy: default
1685           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1686
1687     triggers:
1688       - github-pull-request:
1689           trigger-phrase: "^(recheck|reverify)$"
1690           only-trigger-phrase: false
1691           status-context: "Packer Verify"
1692           permit-all: true
1693           github-hooks: true
1694           included-regions: "{obj:github_included_regions}"
1695           white-list-target-branches:
1696             - "{branch}"
1697
1698 ################################
1699 # Openstack Update Cloud Image #
1700 ################################
1701
1702 - lf_openstack_cron: &lf_openstack_update_cloud_image
1703     name: lf-openstack-update-cloud-image
1704
1705     ######################
1706     # Default parameters #
1707     ######################
1708
1709     branch: master
1710     build-days-to-keep: 7
1711     build-timeout: 10
1712     cron: "@monthly"
1713     disable-job: false
1714     git-url: "$GIT_URL/$PROJECT"
1715     github-url: "https://github.com"
1716     new-image-name: "all"
1717     openstack-cloud: vex
1718     stream: master
1719     submodule-timeout: 10
1720     submodule-disable: false
1721     update-cloud-image: false
1722
1723     #####################
1724     # Job Configuration #
1725     #####################
1726
1727     project-type: freestyle
1728     node: "{build-node}"
1729     concurrent: false
1730     disabled: "{disable-job}"
1731
1732     properties:
1733       - lf-infra-properties:
1734           build-days-to-keep: "{build-days-to-keep}"
1735
1736     parameters:
1737       - lf-infra-parameters:
1738           project: "{project}"
1739           stream: "{stream}"
1740           branch: "{branch}"
1741       - string:
1742           name: NEW_IMAGE_NAME
1743           default: "{new-image-name}"
1744           description: "Name of cloud image to update in Jenkins"
1745
1746     wrappers:
1747       - lf-infra-wrappers:
1748           build-timeout: "{build-timeout}"
1749           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1750       # Listed after to override openstack-infra-wrappers clouds.yaml definition
1751       - config-file-provider:
1752           files:
1753             - file-id: clouds-yaml
1754               target: "$HOME/.config/openstack/clouds.yaml"
1755             - file-id: npmrc
1756               target: "$HOME/.npmrc"
1757             - file-id: pipconf
1758               target: "$HOME/.config/pip/pip.conf"
1759
1760     builders:
1761       - lf-infra-pre-build
1762       - inject:
1763           properties-content: |
1764             OS_CLOUD={openstack-cloud}
1765       - shell: |
1766           #!/bin/bash
1767           echo "Extract the image type for commit message"
1768           # echo IMAGE_TYPE=${{NEW_IMAGE_NAME% -*}} >> image-type.txt
1769           IMAGE_TYPE=$(echo ${{NEW_IMAGE_NAME}} | tr -d "\'\"\ " | awk -F- '{{ print $2 " " $3 " " $4 }}')
1770           echo IMAGE_TYPE=${{IMAGE_TYPE}} >> image-type.txt
1771           cat image-type.txt
1772       - inject:
1773           properties-file: "image-type.txt"
1774       - lf-infra-update-packer-images
1775       - lf-infra-push-gerrit-patch:
1776           project: "{project}"
1777           gerrit-user: "{gerrit-user}"
1778           gerrit-host: "{gerrit-host}"
1779           gerrit-topic: "{gerrit-topic}"
1780           gerrit-commit-message: "Update cloud image $IMAGE_TYPE"
1781           reviewers-email: "{reviewers-email}"
1782
1783     publishers:
1784       - lf-infra-publish
1785
1786 - job-template:
1787     name: "{project-name}-openstack-update-cloud-image"
1788     id: gerrit-openstack-update-cloud-image
1789     <<: *lf_openstack_update_cloud_image
1790
1791     ######################
1792     # Default parameters #
1793     ######################
1794
1795     git-url: "$GIT_URL/$GERRIT_PROJECT"
1796
1797     #####################
1798     # Job Configuration #
1799     #####################
1800
1801     scm:
1802       - lf-infra-gerrit-scm:
1803           git-url: "{git-url}"
1804           refspec: "$GERRIT_REFSPEC"
1805           branch: "$GERRIT_BRANCH"
1806           submodule-recursive: false
1807           submodule-timeout: "{submodule-timeout}"
1808           submodule-disable: "{submodule-disable}"
1809           choosing-strategy: gerrit
1810           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1811
1812     triggers:
1813       - timed: "{obj:cron}"
1814
1815 #################
1816 # Puppet Verify #
1817 #################
1818
1819 - lf_puppet_verify: &lf_puppet_verify
1820     name: lf-puppet-verify
1821
1822     ######################
1823     # Default parameters #
1824     ######################
1825
1826     branch: master
1827     build-days-to-keep: 7
1828     build-timeout: 15
1829     disable-job: false
1830     git-url: "$GIT_URL/$GERRIT_PROJECT"
1831     github-url: "https://github.com"
1832     parallel: true
1833     puppet-dir: ""
1834     puppet-lint-version: 2.3.6
1835     stream: master
1836     submodule-recursive: true
1837     submodule-timeout: 10
1838     submodule-disable: false
1839
1840     gerrit_trigger_file_paths:
1841       - compare-type: REG_EXP
1842         pattern: ".*"
1843
1844     # github_included_regions MUST match gerrit_trigger_file_paths
1845     github_included_regions:
1846       - ".*"
1847
1848     #####################
1849     # Job Configuration #
1850     #####################
1851
1852     project-type: freestyle
1853     node: "{build-node}"
1854     concurrent: true
1855     disabled: "{disable-job}"
1856
1857     properties:
1858       - lf-infra-properties:
1859           build-days-to-keep: "{build-days-to-keep}"
1860
1861     parameters:
1862       - lf-infra-parameters:
1863           project: "{project}"
1864           branch: "{branch}"
1865           stream: "{stream}"
1866       - lf-puppet-parameters:
1867           puppet-lint-version: "{puppet-lint-version}"
1868
1869     wrappers:
1870       - lf-infra-wrappers:
1871           build-timeout: "{build-timeout}"
1872           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1873
1874     builders:
1875       - shell: !include-raw-escape: ../shell/puppet-lint.sh
1876
1877     publishers:
1878       - lf-infra-publish
1879
1880 - job-template:
1881     name: "{project-name}-puppet-verify"
1882     id: gerrit-puppet-verify
1883     <<: *lf_puppet_verify
1884
1885     ######################
1886     # Default parameters #
1887     ######################
1888
1889     gerrit_verify_triggers:
1890       - patchset-created-event:
1891           exclude-drafts: true
1892           exclude-trivial-rebase: false
1893           exclude-no-code-change: false
1894       - draft-published-event
1895       - comment-added-contains-event:
1896           comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
1897
1898     #####################
1899     # Job Configuration #
1900     #####################
1901
1902     scm:
1903       - lf-infra-gerrit-scm:
1904           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1905           git-url: "{git-url}"
1906           refspec: "$GERRIT_REFSPEC"
1907           branch: "$GERRIT_BRANCH"
1908           submodule-recursive: "{submodule-recursive}"
1909           submodule-timeout: "{submodule-timeout}"
1910           submodule-disable: "{submodule-disable}"
1911           choosing-strategy: gerrit
1912
1913     triggers:
1914       - gerrit:
1915           server-name: "{gerrit-server-name}"
1916           trigger-on: "{obj:gerrit_verify_triggers}"
1917           projects:
1918             - project-compare-type: ANT
1919               project-pattern: "{project}"
1920               branches:
1921                 - branch-compare-type: ANT
1922                   branch-pattern: "**/{branch}"
1923               file-paths: "{obj:gerrit_trigger_file_paths}"
1924
1925 - job-template:
1926     name: "{project-name}-puppet-verify"
1927     id: github-puppet-verify
1928     <<: *lf_puppet_verify
1929
1930     #####################
1931     # Job Configuration #
1932     #####################
1933
1934     properties:
1935       - lf-infra-properties:
1936           project: "{project}"
1937           build-days-to-keep: 7
1938       - github:
1939           url: "{github-url}/{github-org}/{project}"
1940
1941     scm:
1942       - lf-infra-github-scm:
1943           url: "{git-clone-url}{github-org}/{project}"
1944           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
1945           branch: "$sha1"
1946           submodule-recursive: "{submodule-recursive}"
1947           submodule-timeout: "{submodule-timeout}"
1948           submodule-disable: "{submodule-disable}"
1949           choosing-strategy: default
1950           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1951
1952     triggers:
1953       - github-pull-request:
1954           trigger-phrase: "^(recheck|reverify)$"
1955           only-trigger-phrase: false
1956           status-context: "Puppet Verify"
1957           permit-all: true
1958           github-hooks: true
1959           included-regions: "{obj:github_included_regions}"
1960           white-list-target-branches:
1961             - "{branch}"
1962
1963 #########
1964 # Sonar #
1965 #########
1966
1967 - lf_sonar_common: &lf_sonar_common
1968     name: lf-sonar-common
1969
1970     ######################
1971     # Default parameters #
1972     ######################
1973
1974     archive-artifacts: >
1975       **/*.log
1976
1977     branch: master # Sonar should always be run on master branch
1978     build-days-to-keep: 7
1979     build-timeout: 60
1980     cron: "H H * * *" # run daily
1981     disable-job: false
1982     git-url: "$GIT_URL/$PROJECT"
1983     github-url: "https://github.com"
1984     stream: master
1985     submodule-recursive: true
1986     submodule-timeout: 10
1987     submodule-disable: false
1988
1989     # Sonar properties
1990     sonar-task: ""
1991     sonar-project-file: "sonar-project.properties"
1992     sonar-properties: ""
1993     sonar-java-opts: ""
1994     sonar-additional-args: ""
1995
1996     gerrit_trigger_file_paths:
1997       - compare-type: REG_EXP
1998         pattern: ".*"
1999
2000     # github_included_regions MUST match gerrit_trigger_file_paths
2001     github_included_regions:
2002       - ".*"
2003
2004     #####################
2005     # Job Configuration #
2006     #####################
2007
2008     project-type: freestyle
2009     node: "{build-node}"
2010
2011     properties:
2012       - lf-infra-properties:
2013           build-days-to-keep: "{build-days-to-keep}"
2014
2015     wrappers:
2016       - lf-infra-wrappers:
2017           build-timeout: "{build-timeout}"
2018           jenkins-ssh-credential: "{jenkins-ssh-credential}"
2019
2020     disabled: "{disable-job}"
2021
2022     parameters:
2023       - lf-infra-parameters:
2024           project: "{project}"
2025           branch: "{branch}"
2026           stream: "{stream}"
2027       - string:
2028           name: ARCHIVE_ARTIFACTS
2029           default: "{archive-artifacts}"
2030           description: Artifacts to archive to the logs server.
2031
2032     publishers:
2033       - lf-infra-publish
2034
2035 - lf_sonar_builders: &lf_sonar_builders
2036     name: lf-sonar-builders
2037     builders:
2038       - lf-infra-pre-build
2039       - lf-infra-sonar:
2040           sonar-task: "{sonar-task}"
2041           sonar-project-file: "{sonar-project-file}"
2042           sonar-properties: "{sonar-properties}"
2043           sonar-java-opts: "{sonar-java-opts}"
2044           sonar-additional-args: "{sonar-additional-args}"
2045
2046 - lf_sonar_builders_prescan: &lf_sonar_builders_prescan
2047     name: lf-sonar-builders-prescan
2048     builders:
2049       - lf-infra-pre-build
2050       - lf-infra-sonar-with-prescan:
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_script: &lf_sonar_builders_prescan_script
2058     name: lf-sonar-builders-prescan-script
2059     builders:
2060       - lf-infra-pre-build
2061       - shell: "{sonar-prescan-script}"
2062       - lf-infra-sonar:
2063           sonar-task: "{sonar-task}"
2064           sonar-project-file: "{sonar-project-file}"
2065           sonar-properties: "{sonar-properties}"
2066           sonar-java-opts: "{sonar-java-opts}"
2067           sonar-additional-args: "{sonar-additional-args}"
2068
2069 - lf_sonar_gerrit_common: &lf_sonar_gerrit_common
2070     name: lf-sonar-gerrit-common
2071     gerrit_sonar_triggers:
2072       - comment-added-contains-event:
2073           comment-contains-value: '^Patch Set\s+\d+:\s+run-sonar\s*$'
2074
2075     scm:
2076       - lf-infra-gerrit-scm:
2077           jenkins-ssh-credential: "{jenkins-ssh-credential}"
2078           git-url: "{git-url}"
2079           refspec: $GERRIT_REFSPEC
2080           branch: $GERRIT_BRANCH
2081           submodule-recursive: "{submodule-recursive}"
2082           submodule-timeout: "{submodule-timeout}"
2083           submodule-disable: "{submodule-disable}"
2084           choosing-strategy: default
2085
2086     triggers:
2087       - timed: "{obj:cron}"
2088       - gerrit:
2089           server-name: "{gerrit-server-name}"
2090           trigger-on: "{obj:gerrit_sonar_triggers}"
2091           projects:
2092             - project-compare-type: "ANT"
2093               project-pattern: "{project}"
2094               branches:
2095                 - branch-compare-type: "ANT"
2096                   branch-pattern: "**/{branch}"
2097               file-paths: "{obj:gerrit_trigger_file_paths}"
2098           skip-vote:
2099             successful: true
2100             failed: true
2101             unstable: true
2102             notbuilt: true
2103
2104 - lf_sonar_github_common: &lf_sonar_github_common
2105     name: lf-sonar-github-common
2106     properties:
2107       - lf-infra-properties:
2108           build-days-to-keep: "{build-days-to-keep}"
2109       - github:
2110           url: "{github-url}/{github-org}/{project}"
2111
2112     scm:
2113       - lf-infra-github-scm:
2114           url: "{git-clone-url}{github-org}/{project}"
2115           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
2116           branch: "$sha1"
2117           submodule-recursive: "{submodule-recursive}"
2118           submodule-timeout: "{submodule-timeout}"
2119           submodule-disable: "{submodule-disable}"
2120           choosing-strategy: default
2121           jenkins-ssh-credential: "{jenkins-ssh-credential}"
2122
2123     triggers:
2124       - github-pull-request:
2125           trigger-phrase: "^run-sonar$"
2126           only-trigger-phrase: false
2127           status-context: "Python Sonar"
2128           permit-all: true
2129           github-hooks: true
2130           white-list-target-branches:
2131             - "{branch}"
2132           included-regions: "{obj:github_included_regions}"
2133
2134 - job-template:
2135     name: "{project-name}-sonar"
2136     id: gerrit-sonar
2137     <<: *lf_sonar_common
2138     # yamllint disable-line rule:key-duplicates
2139     <<: *lf_sonar_builders
2140     # yamllint disable-line rule:key-duplicates
2141     <<: *lf_sonar_gerrit_common
2142
2143 - job-template:
2144     name: "{project-name}-sonar"
2145     id: github-sonar
2146     <<: *lf_sonar_common
2147     # yamllint disable-line rule:key-duplicates
2148     <<: *lf_sonar_builders
2149     # yamllint disable-line rule:key-duplicates
2150     <<: *lf_sonar_github_common
2151
2152 - job-template:
2153     name: "{project-name}-sonar-prescan"
2154     id: gerrit-sonar-prescan
2155     <<: *lf_sonar_common
2156     # yamllint disable-line rule:key-duplicates
2157     <<: *lf_sonar_builders_prescan
2158     # yamllint disable-line rule:key-duplicates
2159     <<: *lf_sonar_gerrit_common
2160
2161 - job-template:
2162     name: "{project-name}-sonar-prescan"
2163     id: github-sonar-prescan
2164     <<: *lf_sonar_common
2165     # yamllint disable-line rule:key-duplicates
2166     <<: *lf_sonar_builders_prescan
2167     # yamllint disable-line rule:key-duplicates
2168     <<: *lf_sonar_github_common
2169
2170 - job-template:
2171     name: "{project-name}-sonar-prescan-script"
2172     id: gerrit-sonar-prescan-script
2173     <<: *lf_sonar_common
2174     # yamllint disable-line rule:key-duplicates
2175     <<: *lf_sonar_builders_prescan_script
2176     # yamllint disable-line rule:key-duplicates
2177     <<: *lf_sonar_gerrit_common
2178
2179 - job-template:
2180     name: "{project-name}-sonar-prescan-script"
2181     id: github-sonar-prescan-script
2182     <<: *lf_sonar_common
2183     # yamllint disable-line rule:key-duplicates
2184     <<: *lf_sonar_builders_prescan_script
2185     # yamllint disable-line rule:key-duplicates
2186     <<: *lf_sonar_github_common