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