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