Fix rtd merge job to handle new tag uploaded
[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     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     update-cloud-image: false
1422
1423     #####################
1424     # Job Configuration #
1425     #####################
1426
1427     parameters:
1428       - lf-infra-parameters:
1429           project: "{project}"
1430           stream: "{stream}"
1431           branch: "{branch}"
1432       - lf-packer-parameters:
1433           packer-version: "{packer-version}"
1434       - bool:
1435           name: UPDATE_CLOUD_IMAGE
1436           default: "{update-cloud-image}"
1437           description: "Update new built image on the cloud."
1438
1439     builders:
1440       - lf-infra-packer-build:
1441           openstack: "{openstack}"
1442           openstack-cloud: "{openstack-cloud}"
1443           packer-cloud-settings: "{packer-cloud-settings}"
1444           packer-version: "{packer-version}"
1445           platform: "{platforms}"
1446           template: "{templates}"
1447           update-cloud-image: "{update-cloud-image}"
1448       - description-setter:
1449           regexp: '(\s+.*)(ZZCI\s+.*\d+-\d+\.\d+)'
1450           description: 'Image: \2'
1451       # - trigger-builds:
1452       #     - project: '{project-name}-openstack-update-cloud-image'
1453       #       block: false
1454       #       predefined-parameters: |
1455       #         GERRIT_BRANCH=$GERRIT_BRANCH
1456       #         GERRIT_PROJECT=$GERRIT_PROJECT
1457       #         GERRIT_REFSPEC=$GERRIT_REFSPEC
1458       #         NEW_IMAGE_NAME=$NEW_IMAGE_NAME
1459       #       property-file: variables.jenkins-trigger
1460       #       property-file-fail-on-missing: true
1461
1462     publishers:
1463       - lf-infra-publish
1464       - trigger-parameterized-builds:
1465           - project: "{project-name}-openstack-update-cloud-image"
1466             condition: UNSTABLE_OR_BETTER
1467             predefined-parameters: |
1468               NEW_IMAGE_NAME=$NEW_IMAGE_NAME
1469             property-file: variables.jenkins-trigger
1470             fail-on-missing: true
1471
1472 - job-template:
1473     name: "{project-name}-packer-merge-{platforms}-{templates}"
1474     id: gerrit-packer-merge
1475     <<: *lf_packer_common
1476     # yamllint disable-line rule:key-duplicates
1477     <<: *lf_packer_merge
1478
1479     ######################
1480     # Default parameters #
1481     ######################
1482
1483     git-url: "$GIT_URL/$GERRIT_PROJECT"
1484
1485     gerrit_merge_triggers:
1486       - change-merged-event
1487       - comment-added-contains-event:
1488           comment-contains-value: '^Patch Set\s+\d+:\s+remerge\s*$'
1489
1490     #####################
1491     # Job Configuration #
1492     #####################
1493
1494     scm:
1495       - lf-infra-gerrit-scm:
1496           git-url: "{git-url}"
1497           refspec: "$GERRIT_REFSPEC"
1498           branch: "$GERRIT_BRANCH"
1499           submodule-recursive: "{submodule-recursive}"
1500           submodule-timeout: "{submodule-timeout}"
1501           submodule-disable: "{submodule-disable}"
1502           choosing-strategy: default
1503           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1504
1505     triggers:
1506       - timed: "{obj:cron}"
1507       - gerrit:
1508           server-name: "{gerrit-server-name}"
1509           trigger-on: "{obj:gerrit_merge_triggers}"
1510           projects:
1511             - project-compare-type: ANT
1512               project-pattern: "{project}"
1513               branches:
1514                 - branch-compare-type: ANT
1515                   branch-pattern: "**/{branch}"
1516               file-paths:
1517                 - compare-type: REG_EXP
1518                   pattern: 'packer\/provision\/.*\.sh'
1519                 - compare-type: REG_EXP
1520                   pattern: 'packer\/provision\/.*\.bat'
1521                 - compare-type: REG_EXP
1522                   pattern: 'packer\/provision\/.*\.ps1'
1523                 - compare-type: REG_EXP
1524                   pattern: 'packer\/provision\/{templates}\.yaml'
1525                 - compare-type: REG_EXP
1526                   pattern: 'packer\/provision\/local-{templates}\.yaml'
1527                 - compare-type: REG_EXP
1528                   pattern: 'packer\/templates\/{templates}\.json'
1529                 - compare-type: REG_EXP
1530                   pattern: 'packer\/vars\/{platforms}\.json'
1531
1532 - job-template:
1533     name: "{project-name}-packer-merge-{platforms}-{templates}"
1534     id: github-packer-merge
1535     <<: *lf_packer_common
1536     # yamllint disable-line rule:key-duplicates
1537     <<: *lf_packer_merge
1538
1539     #####################
1540     # Job Configuration #
1541     #####################
1542
1543     properties:
1544       - lf-infra-properties:
1545           project: "{project}"
1546           build-days-to-keep: 7
1547       - github:
1548           url: "{github-url}/{github-org}/{project}"
1549
1550     scm:
1551       - lf-infra-github-scm:
1552           url: "{git-clone-url}{github-org}/{project}"
1553           refspec: >
1554             +refs/heads/*:refs/remotes/origin/*
1555             +refs/pull/*:refs/remotes/origin/pr/*
1556           branch: "$GERRIT_REFSPEC"
1557           submodule-recursive: "{submodule-recursive}"
1558           submodule-timeout: "{submodule-timeout}"
1559           submodule-disable: "{submodule-disable}"
1560           choosing-strategy: default
1561           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1562
1563     triggers:
1564       - timed: "{obj:cron}"
1565       - github
1566       - pollscm:
1567           cron: ""
1568
1569       - github-pull-request:
1570           trigger-phrase: "^remerge$"
1571           only-trigger-phrase: true
1572           status-context: "Packer {platforms}-{templates} Merge"
1573           permit-all: true
1574           github-hooks: true
1575           org-list:
1576             - "{github-org}"
1577           white-list: "{obj:github_pr_whitelist}"
1578           admin-list: "{obj:github_pr_admin_list}"
1579           # included-regions MUST match Gerrit Trigger file-paths
1580           included-regions:
1581             - 'packer\/provision\/.*\.sh'
1582             - 'packer\/provision\/.*\.bat'
1583             - 'packer\/provision\/.*\.ps1'
1584             - 'packer\/provision\/{templates}\.yaml'
1585             - 'packer\/provision\/local-{templates}\.yaml'
1586             - 'packer\/templates\/{templates}\.json'
1587             - 'packer\/vars\/{platforms}\.json'
1588           white-list-target-branches:
1589             - "{branch}"
1590
1591 #################
1592 # Packer Verify #
1593 #################
1594
1595 - lf_packer_verify: &lf_packer_verify
1596     name: lf-packer-verify
1597
1598     ######################
1599     # Default parameters #
1600     ######################
1601
1602     build-timeout: 10
1603     openstack: true
1604     openstack-cloud: vex
1605
1606     gerrit_verify_triggers:
1607       - patchset-created-event:
1608           exclude-drafts: true
1609           exclude-trivial-rebase: false
1610           exclude-no-code-change: false
1611       - draft-published-event
1612       - comment-added-contains-event:
1613           comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
1614
1615     gerrit_trigger_file_paths:
1616       - compare-type: REG_EXP
1617         pattern: 'packer\/.*'
1618
1619     # github_included_regions MUST match gerrit_trigger_file_paths
1620     github_included_regions:
1621       - 'packer\/.*'
1622
1623     #####################
1624     # Job Configuration #
1625     #####################
1626
1627     concurrent: true
1628
1629     builders:
1630       - lf-infra-packer-validate:
1631           openstack: "{openstack}"
1632           openstack-cloud: "{openstack-cloud}"
1633           packer-cloud-settings: "{packer-cloud-settings}"
1634           packer-version: "{packer-version}"
1635
1636 - job-template:
1637     name: "{project-name}-packer-verify"
1638     id: gerrit-packer-verify
1639     <<: *lf_packer_common
1640     # yamllint disable-line rule:key-duplicates
1641     <<: *lf_packer_verify
1642
1643     ######################
1644     # Default parameters #
1645     ######################
1646
1647     git-url: "$GIT_URL/$GERRIT_PROJECT"
1648
1649     #####################
1650     # Job Configuration #
1651     #####################
1652
1653     scm:
1654       - lf-infra-gerrit-scm:
1655           git-url: "{git-url}"
1656           refspec: "$GERRIT_REFSPEC"
1657           branch: "$GERRIT_BRANCH"
1658           submodule-recursive: "{submodule-recursive}"
1659           submodule-timeout: "{submodule-timeout}"
1660           submodule-disable: "{submodule-disable}"
1661           choosing-strategy: gerrit
1662           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1663
1664     triggers:
1665       - gerrit:
1666           server-name: "{gerrit-server-name}"
1667           trigger-on: "{obj:gerrit_verify_triggers}"
1668           projects:
1669             - project-compare-type: ANT
1670               project-pattern: "{project}"
1671               branches:
1672                 - branch-compare-type: ANT
1673                   branch-pattern: "**/{branch}"
1674               file-paths: "{obj:gerrit_trigger_file_paths}"
1675
1676 - job-template:
1677     name: "{project-name}-packer-verify"
1678     id: github-packer-verify
1679     <<: *lf_packer_common
1680     # yamllint disable-line rule:key-duplicates
1681     <<: *lf_packer_verify
1682
1683     #####################
1684     # Job Configuration #
1685     #####################
1686
1687     properties:
1688       - lf-infra-properties:
1689           project: "{project}"
1690           build-days-to-keep: 7
1691       - github:
1692           url: "{github-url}/{github-org}/{project}"
1693
1694     scm:
1695       - lf-infra-github-scm:
1696           url: "{git-clone-url}{github-org}/{project}"
1697           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
1698           branch: "$sha1"
1699           submodule-recursive: "{submodule-recursive}"
1700           submodule-timeout: "{submodule-timeout}"
1701           submodule-disable: "{submodule-disable}"
1702           choosing-strategy: default
1703           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1704
1705     triggers:
1706       - github-pull-request:
1707           trigger-phrase: "^(recheck|reverify)$"
1708           only-trigger-phrase: false
1709           status-context: "Packer Verify"
1710           permit-all: true
1711           github-hooks: true
1712           included-regions: "{obj:github_included_regions}"
1713           white-list-target-branches:
1714             - "{branch}"
1715
1716 ################################
1717 # Openstack Update Cloud Image #
1718 ################################
1719
1720 - lf_openstack_cron: &lf_openstack_update_cloud_image
1721     name: lf-openstack-update-cloud-image
1722
1723     ######################
1724     # Default parameters #
1725     ######################
1726
1727     branch: master
1728     build-days-to-keep: 7
1729     build-timeout: 10
1730     cron: "@monthly"
1731     disable-job: false
1732     git-url: "$GIT_URL/$PROJECT"
1733     github-url: "https://github.com"
1734     new-image-name: "all"
1735     openstack-cloud: vex
1736     stream: master
1737     submodule-timeout: 10
1738     submodule-disable: false
1739     update-cloud-image: false
1740
1741     #####################
1742     # Job Configuration #
1743     #####################
1744
1745     project-type: freestyle
1746     node: "{build-node}"
1747     concurrent: false
1748     disabled: "{disable-job}"
1749
1750     properties:
1751       - lf-infra-properties:
1752           build-days-to-keep: "{build-days-to-keep}"
1753
1754     parameters:
1755       - lf-infra-parameters:
1756           project: "{project}"
1757           stream: "{stream}"
1758           branch: "{branch}"
1759       - string:
1760           name: NEW_IMAGE_NAME
1761           default: "{new-image-name}"
1762           description: "Name of cloud image to update in Jenkins"
1763
1764     wrappers:
1765       - lf-infra-wrappers:
1766           build-timeout: "{build-timeout}"
1767           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1768       # Listed after to override openstack-infra-wrappers clouds.yaml definition
1769       - config-file-provider:
1770           files:
1771             - file-id: clouds-yaml
1772               target: "$HOME/.config/openstack/clouds.yaml"
1773             - file-id: npmrc
1774               target: "$HOME/.npmrc"
1775             - file-id: pipconf
1776               target: "$HOME/.config/pip/pip.conf"
1777
1778     builders:
1779       - lf-infra-pre-build
1780       - inject:
1781           properties-content: |
1782             OS_CLOUD={openstack-cloud}
1783       - shell: |
1784           #!/bin/bash
1785           echo "Extract the image type for commit message"
1786           # echo IMAGE_TYPE=${{NEW_IMAGE_NAME% -*}} >> image-type.txt
1787           IMAGE_TYPE=$(echo ${{NEW_IMAGE_NAME}} | tr -d "\'\"\ " | awk -F- '{{ print $2 " " $3 " " $4 }}')
1788           echo IMAGE_TYPE=${{IMAGE_TYPE}} >> image-type.txt
1789           cat image-type.txt
1790       - inject:
1791           properties-file: "image-type.txt"
1792       - lf-infra-update-packer-images
1793       - lf-infra-push-gerrit-patch:
1794           project: "{project}"
1795           gerrit-user: "{gerrit-user}"
1796           gerrit-host: "{gerrit-host}"
1797           gerrit-topic: "{gerrit-topic}"
1798           gerrit-commit-message: "Update cloud image $IMAGE_TYPE"
1799           reviewers-email: "{reviewers-email}"
1800
1801     publishers:
1802       - lf-infra-publish
1803
1804 - job-template:
1805     name: "{project-name}-openstack-update-cloud-image"
1806     id: gerrit-openstack-update-cloud-image
1807     <<: *lf_openstack_update_cloud_image
1808
1809     ######################
1810     # Default parameters #
1811     ######################
1812
1813     git-url: "$GIT_URL/$GERRIT_PROJECT"
1814
1815     #####################
1816     # Job Configuration #
1817     #####################
1818
1819     scm:
1820       - lf-infra-gerrit-scm:
1821           git-url: "{git-url}"
1822           refspec: "$GERRIT_REFSPEC"
1823           branch: "$GERRIT_BRANCH"
1824           submodule-recursive: false
1825           submodule-timeout: "{submodule-timeout}"
1826           submodule-disable: "{submodule-disable}"
1827           choosing-strategy: gerrit
1828           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1829
1830     triggers:
1831       - timed: "{obj:cron}"
1832
1833 #################
1834 # Puppet Verify #
1835 #################
1836
1837 - lf_puppet_verify: &lf_puppet_verify
1838     name: lf-puppet-verify
1839
1840     ######################
1841     # Default parameters #
1842     ######################
1843
1844     branch: master
1845     build-days-to-keep: 7
1846     build-timeout: 15
1847     disable-job: false
1848     git-url: "$GIT_URL/$GERRIT_PROJECT"
1849     github-url: "https://github.com"
1850     parallel: true
1851     puppet-dir: ""
1852     puppet-lint-version: 2.3.6
1853     stream: master
1854     submodule-recursive: true
1855     submodule-timeout: 10
1856     submodule-disable: false
1857
1858     gerrit_trigger_file_paths:
1859       - compare-type: REG_EXP
1860         pattern: ".*"
1861
1862     # github_included_regions MUST match gerrit_trigger_file_paths
1863     github_included_regions:
1864       - ".*"
1865
1866     #####################
1867     # Job Configuration #
1868     #####################
1869
1870     project-type: freestyle
1871     node: "{build-node}"
1872     concurrent: true
1873     disabled: "{disable-job}"
1874
1875     properties:
1876       - lf-infra-properties:
1877           build-days-to-keep: "{build-days-to-keep}"
1878
1879     parameters:
1880       - lf-infra-parameters:
1881           project: "{project}"
1882           branch: "{branch}"
1883           stream: "{stream}"
1884       - lf-puppet-parameters:
1885           puppet-lint-version: "{puppet-lint-version}"
1886
1887     wrappers:
1888       - lf-infra-wrappers:
1889           build-timeout: "{build-timeout}"
1890           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1891
1892     builders:
1893       - shell: !include-raw-escape: ../shell/puppet-lint.sh
1894
1895     publishers:
1896       - lf-infra-publish
1897
1898 - job-template:
1899     name: "{project-name}-puppet-verify"
1900     id: gerrit-puppet-verify
1901     <<: *lf_puppet_verify
1902
1903     ######################
1904     # Default parameters #
1905     ######################
1906
1907     gerrit_verify_triggers:
1908       - patchset-created-event:
1909           exclude-drafts: true
1910           exclude-trivial-rebase: false
1911           exclude-no-code-change: false
1912       - draft-published-event
1913       - comment-added-contains-event:
1914           comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
1915
1916     #####################
1917     # Job Configuration #
1918     #####################
1919
1920     scm:
1921       - lf-infra-gerrit-scm:
1922           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1923           git-url: "{git-url}"
1924           refspec: "$GERRIT_REFSPEC"
1925           branch: "$GERRIT_BRANCH"
1926           submodule-recursive: "{submodule-recursive}"
1927           submodule-timeout: "{submodule-timeout}"
1928           submodule-disable: "{submodule-disable}"
1929           choosing-strategy: gerrit
1930
1931     triggers:
1932       - gerrit:
1933           server-name: "{gerrit-server-name}"
1934           trigger-on: "{obj:gerrit_verify_triggers}"
1935           projects:
1936             - project-compare-type: ANT
1937               project-pattern: "{project}"
1938               branches:
1939                 - branch-compare-type: ANT
1940                   branch-pattern: "**/{branch}"
1941               file-paths: "{obj:gerrit_trigger_file_paths}"
1942
1943 - job-template:
1944     name: "{project-name}-puppet-verify"
1945     id: github-puppet-verify
1946     <<: *lf_puppet_verify
1947
1948     #####################
1949     # Job Configuration #
1950     #####################
1951
1952     properties:
1953       - lf-infra-properties:
1954           project: "{project}"
1955           build-days-to-keep: 7
1956       - github:
1957           url: "{github-url}/{github-org}/{project}"
1958
1959     scm:
1960       - lf-infra-github-scm:
1961           url: "{git-clone-url}{github-org}/{project}"
1962           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
1963           branch: "$sha1"
1964           submodule-recursive: "{submodule-recursive}"
1965           submodule-timeout: "{submodule-timeout}"
1966           submodule-disable: "{submodule-disable}"
1967           choosing-strategy: default
1968           jenkins-ssh-credential: "{jenkins-ssh-credential}"
1969
1970     triggers:
1971       - github-pull-request:
1972           trigger-phrase: "^(recheck|reverify)$"
1973           only-trigger-phrase: false
1974           status-context: "Puppet Verify"
1975           permit-all: true
1976           github-hooks: true
1977           included-regions: "{obj:github_included_regions}"
1978           white-list-target-branches:
1979             - "{branch}"
1980
1981 #########
1982 # Sonar #
1983 #########
1984
1985 - lf_sonar_common: &lf_sonar_common
1986     name: lf-sonar-common
1987
1988     ######################
1989     # Default parameters #
1990     ######################
1991
1992     archive-artifacts: >
1993       **/*.log
1994
1995     branch: master # Sonar should always be run on master branch
1996     build-days-to-keep: 7
1997     build-timeout: 60
1998     cron: "H H * * *" # run daily
1999     disable-job: false
2000     git-url: "$GIT_URL/$PROJECT"
2001     github-url: "https://github.com"
2002     stream: master
2003     submodule-recursive: true
2004     submodule-timeout: 10
2005     submodule-disable: false
2006
2007     # Sonar properties
2008     sonar-task: ""
2009     sonar-project-file: "sonar-project.properties"
2010     sonar-properties: ""
2011     sonar-java-opts: ""
2012     sonar-additional-args: ""
2013
2014     gerrit_trigger_file_paths:
2015       - compare-type: REG_EXP
2016         pattern: ".*"
2017
2018     # github_included_regions MUST match gerrit_trigger_file_paths
2019     github_included_regions:
2020       - ".*"
2021
2022     #####################
2023     # Job Configuration #
2024     #####################
2025
2026     project-type: freestyle
2027     node: "{build-node}"
2028
2029     properties:
2030       - lf-infra-properties:
2031           build-days-to-keep: "{build-days-to-keep}"
2032
2033     wrappers:
2034       - lf-infra-wrappers:
2035           build-timeout: "{build-timeout}"
2036           jenkins-ssh-credential: "{jenkins-ssh-credential}"
2037
2038     disabled: "{disable-job}"
2039
2040     parameters:
2041       - lf-infra-parameters:
2042           project: "{project}"
2043           branch: "{branch}"
2044           stream: "{stream}"
2045       - string:
2046           name: ARCHIVE_ARTIFACTS
2047           default: "{archive-artifacts}"
2048           description: Artifacts to archive to the logs server.
2049
2050     publishers:
2051       - lf-infra-publish
2052
2053 - lf_sonar_builders: &lf_sonar_builders
2054     name: lf-sonar-builders
2055     builders:
2056       - lf-infra-pre-build
2057       - lf-infra-sonar:
2058           sonar-task: "{sonar-task}"
2059           sonar-project-file: "{sonar-project-file}"
2060           sonar-properties: "{sonar-properties}"
2061           sonar-java-opts: "{sonar-java-opts}"
2062           sonar-additional-args: "{sonar-additional-args}"
2063
2064 - lf_sonar_builders_prescan: &lf_sonar_builders_prescan
2065     name: lf-sonar-builders-prescan
2066     builders:
2067       - lf-infra-pre-build
2068       - lf-infra-sonar-with-prescan:
2069           sonar-task: "{sonar-task}"
2070           sonar-project-file: "{sonar-project-file}"
2071           sonar-properties: "{sonar-properties}"
2072           sonar-java-opts: "{sonar-java-opts}"
2073           sonar-additional-args: "{sonar-additional-args}"
2074
2075 - lf_sonar_gerrit_common: &lf_sonar_gerrit_common
2076     name: lf-sonar-gerrit-common
2077     gerrit_sonar_triggers:
2078       - comment-added-contains-event:
2079           comment-contains-value: '^Patch Set\s+\d+:\s+run-sonar\s*$'
2080
2081     scm:
2082       - lf-infra-gerrit-scm:
2083           jenkins-ssh-credential: "{jenkins-ssh-credential}"
2084           git-url: "{git-url}"
2085           refspec: $GERRIT_REFSPEC
2086           branch: $GERRIT_BRANCH
2087           submodule-recursive: "{submodule-recursive}"
2088           submodule-timeout: "{submodule-timeout}"
2089           submodule-disable: "{submodule-disable}"
2090           choosing-strategy: default
2091
2092     triggers:
2093       - timed: "{obj:cron}"
2094       - gerrit:
2095           server-name: "{gerrit-server-name}"
2096           trigger-on: "{obj:gerrit_sonar_triggers}"
2097           projects:
2098             - project-compare-type: "ANT"
2099               project-pattern: "{project}"
2100               branches:
2101                 - branch-compare-type: "ANT"
2102                   branch-pattern: "**/{branch}"
2103               file-paths: "{obj:gerrit_trigger_file_paths}"
2104           skip-vote:
2105             successful: true
2106             failed: true
2107             unstable: true
2108             notbuilt: true
2109
2110 - lf_sonar_github_common: &lf_sonar_github_common
2111     name: lf-sonar-github-common
2112     properties:
2113       - lf-infra-properties:
2114           build-days-to-keep: "{build-days-to-keep}"
2115       - github:
2116           url: "{github-url}/{github-org}/{project}"
2117
2118     scm:
2119       - lf-infra-github-scm:
2120           url: "{git-clone-url}{github-org}/{project}"
2121           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
2122           branch: "$sha1"
2123           submodule-recursive: "{submodule-recursive}"
2124           submodule-timeout: "{submodule-timeout}"
2125           submodule-disable: "{submodule-disable}"
2126           choosing-strategy: default
2127           jenkins-ssh-credential: "{jenkins-ssh-credential}"
2128
2129     triggers:
2130       - github-pull-request:
2131           trigger-phrase: "^run-sonar$"
2132           only-trigger-phrase: false
2133           status-context: "Python Sonar"
2134           permit-all: true
2135           github-hooks: true
2136           white-list-target-branches:
2137             - "{branch}"
2138           included-regions: "{obj:github_included_regions}"
2139
2140 - job-template:
2141     name: "{project-name}-sonar"
2142     id: gerrit-sonar
2143     <<: *lf_sonar_common
2144     # yamllint disable-line rule:key-duplicates
2145     <<: *lf_sonar_builders
2146     # yamllint disable-line rule:key-duplicates
2147     <<: *lf_sonar_gerrit_common
2148
2149 - job-template:
2150     name: "{project-name}-sonar"
2151     id: github-sonar
2152     <<: *lf_sonar_common
2153     # yamllint disable-line rule:key-duplicates
2154     <<: *lf_sonar_builders
2155     # yamllint disable-line rule:key-duplicates
2156     <<: *lf_sonar_github_common
2157
2158 - job-template:
2159     name: "{project-name}-sonar-prescan"
2160     id: gerrit-sonar-prescan
2161     <<: *lf_sonar_common
2162     # yamllint disable-line rule:key-duplicates
2163     <<: *lf_sonar_builders_prescan
2164     # yamllint disable-line rule:key-duplicates
2165     <<: *lf_sonar_gerrit_common
2166
2167 - job-template:
2168     name: "{project-name}-sonar-prescan"
2169     id: github-sonar-prescan
2170     <<: *lf_sonar_common
2171     # yamllint disable-line rule:key-duplicates
2172     <<: *lf_sonar_builders_prescan
2173     # yamllint disable-line rule:key-duplicates
2174     <<: *lf_sonar_github_common