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