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