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