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