502b1cf65ff0de869bb7e6a5cba3948afb7dbf87
[releng/global-jjb.git] / jjb / lf-ci-jobs.yaml
1 ---
2
3 ####################
4 # COMMON FUNCTIONS #
5 ####################
6
7 - builder:
8     name: lf-infra-jjbini
9     builders:
10       - config-file-provider:
11           files:
12             - file-id: jjbini
13               target: '$HOME/.config/jenkins_jobs/jenkins_jobs.ini'
14
15 - builder:
16     name: lf-infra-jjbini-sandbox
17     # TODO: Consolidate this into jjbini when JJB2.0 is available.
18     builders:
19       - config-file-provider:
20           files:
21             - file-id: jjbini-sandbox
22               target: '$HOME/.config/jenkins_jobs/jenkins_jobs.ini'
23
24 - lf_packer: &lf_packer_common
25     name: lf-packer-common
26     # Provide configuration common in packer jobs.
27
28     ######################
29     # Default parameters #
30     ######################
31
32     branch: master
33     build-timeout: 90
34     cron: '@monthly'
35     disable-job: false
36     github-url: 'https://github.com'
37     stream: master
38     submodule-recursive: true
39     packer-cloud-settings: packer-cloud-env
40     packer-version: 1.2.5
41
42     #####################
43     # Job Configuration #
44     #####################
45
46     project-type: freestyle
47     node: '{build-node}'
48     disabled: '{disable-job}'
49
50     properties:
51       - lf-infra-properties:
52           project: '{project}'
53           build-days-to-keep: 7
54
55     parameters:
56       - lf-infra-parameters:
57           project: '{project}'
58           stream: '{stream}'
59           branch: '{branch}'
60           lftools-version: '{lftools-version}'
61       - lf-packer-parameters:
62           packer-version: '{packer-version}'
63
64     wrappers:
65       - lf-infra-wrappers:
66           build-timeout: '{build-timeout}'
67           jenkins-ssh-credential: '{jenkins-ssh-credential}'
68
69     publishers:
70       - lf-infra-publish
71
72 - parameter:
73     name: lf-infra-jjb-parameters
74     parameters:
75       - string:
76           name: JJB_VERSION
77           default: '{jjb-version}'
78           description: Jenkins Job Builder version to download and install.
79
80 - parameter:
81     name: lf-packer-parameters
82     parameters:
83       - string:
84           name: PACKER_VERSION
85           default: '{packer-version}'
86           description: Packer version to download and install.
87
88 - lf_jjb_common: &lf_jjb_common
89     name: lf-jjb-common
90
91     ######################
92     # Default parameters #
93     ######################
94
95     branch: master
96     build-timeout: 10
97     disable-job: false
98     github-url: 'https://github.com'
99     jjb-version: 2.2.1
100     stream: master
101     submodule-recursive: true
102
103     gerrit_trigger_file_paths:
104       - compare-type: REG_EXP
105         pattern: '.*\.groovy'
106       - compare-type: REG_EXP
107         pattern: '.*\.sh'
108       - compare-type: REG_EXP
109         pattern: '.*\.bat'
110       - compare-type: REG_EXP
111         pattern: '.*\.ps1'
112       - compare-type: REG_EXP
113         pattern: 'jjb/.*'
114       - compare-type: REG_EXP
115         pattern: 'global-jjb'
116
117     # github_included_regions MUST match gerrit_trigger_file_paths
118     github_included_regions:
119       - '.*\.groovy'
120       - '.*\.sh'
121       - '.*\.bat'
122       - '.*\.ps1'
123       - 'jjb/.*'
124       - 'global-jjb'
125
126     #####################
127     # Job Configuration #
128     #####################
129
130     project-type: freestyle
131     node: '{build-node}'
132     disabled: '{disable-job}'
133
134     properties:
135       - lf-infra-properties:
136           project: '{project}'
137           build-days-to-keep: 7
138
139     parameters:
140       - lf-infra-parameters:
141           project: '{project}'
142           stream: '{stream}'
143           branch: '{branch}'
144           lftools-version: '{lftools-version}'
145       - lf-infra-jjb-parameters:
146           jjb-version: '{jjb-version}'
147
148     wrappers:
149       - lf-infra-wrappers:
150           build-timeout: '{build-timeout}'
151           jenkins-ssh-credential: '{jenkins-ssh-credential}'
152
153     publishers:
154       - lf-infra-publish
155
156 ######################
157 # Gerrit Branch Lock #
158 ######################
159
160 - job-template:
161     name: '{project-name}-gerrit-branch-lock-{stream}'
162     id: gerrit-branch-lock
163
164     ######################
165     # Default parameters #
166     ######################
167
168     branch: master
169     disable-job: false
170     git-url: '$GIT_URL/$GERRIT_PROJECT'
171     stream: master
172     gerrit_merge_triggers:
173       - comment-added-contains-event:
174           comment-contains-value: (un)?lock branch$
175
176     #####################
177     # Job Configuration #
178     #####################
179
180     project-type: freestyle
181     node: '{build-node}'
182     disabled: '{disable-job}'
183
184     properties:
185       - lf-infra-properties:
186           project: '{project}'
187           build-days-to-keep: 1
188
189     parameters:
190       - lf-infra-parameters:
191           project: '{project}'
192           stream: '{stream}'
193           branch: '{branch}'
194           lftools-version: '{lftools-version}'
195
196     wrappers:
197       - lf-infra-wrappers:
198           build-timeout: 5
199           jenkins-ssh-credential: '{jenkins-ssh-credential}'
200
201     scm:
202       - lf-infra-gerrit-scm:
203           git-url: '{git-url}'
204           refspec: ''
205           branch: '{branch}'
206           submodule-recursive: false
207           choosing-strategy: default
208           jenkins-ssh-credential: '{jenkins-ssh-credential}'
209
210     triggers:
211       - gerrit:
212           server-name: '{gerrit-server-name}'
213           trigger-on: '{obj:gerrit_merge_triggers}'
214           projects:
215             - project-compare-type: ANT
216               project-pattern: '{project}'
217               branches:
218                 - branch-compare-type: ANT
219                   branch-pattern: '**/{branch}'
220
221     builders:
222       - shell: !include-raw-escape: ../shell/gerrit-branch-lock.sh
223
224
225     publishers:
226       - lf-infra-publish
227
228 ##########################################
229 # Jenkins Configuration Management Merge #
230 ##########################################
231
232 - builder:
233     name: lf-jenkins-cfg-clouds
234     builders:
235       - lf-infra-jjbini
236       - inject:
237           properties-content: 'jenkins_silos={jenkins-silos}'
238       - shell: !include-raw-escape: ../shell/jenkins-configure-clouds.sh
239       - shell: rm -f "$HOME/.config/jenkins_jobs/jenkins_jobs.ini"
240
241 - builder:
242     name: lf-jenkins-cfg-global-vars
243     builders:
244       - lf-infra-jjbini
245       - inject:
246           properties-content: 'jenkins_silos={jenkins-silos}'
247       - shell: !include-raw-escape: ../shell/jenkins-configure-global-vars.sh
248       - shell: rm -f "$HOME/.config/jenkins_jobs/jenkins_jobs.ini"
249
250 - lf_jenkins_configuration: &lf_jenkins_cfg_merge
251     name: lf-jenkins-cfg-merge
252
253     ######################
254     # Default parameters #
255     ######################
256
257     branch: master
258     cron: '@daily'
259     disable-job: false
260     git-url: '$GIT_URL/$GERRIT_PROJECT'
261     github-url: 'https://github.com'
262     jenkins-silos: production sandbox
263
264     gerrit_merge_triggers:
265       - change-merged-event
266       - comment-added-contains-event:
267           comment-contains-value: remerge$
268
269     gerrit_trigger_file_paths:
270       - compare-type: REG_EXP
271         pattern: 'jenkins-config\/.*'
272
273     # github_included_regions MUST match gerrit_trigger_file_paths
274     github_included_regions:
275       - 'jenkins-config\/.*'
276
277     #####################
278     # Job Configuration #
279     #####################
280
281     project-type: freestyle
282     node: '{build-node}'
283     concurrent: false
284     disabled: '{disable-job}'
285
286     properties:
287       - lf-infra-properties:
288           project: '{project}'
289           build-days-to-keep: 1
290
291     parameters:
292       - lf-infra-parameters:
293           project: '{project}'
294           stream: ''
295           branch: master
296           lftools-version: '{lftools-version}'
297
298     wrappers:
299       - lf-infra-wrappers:
300           build-timeout: 10
301           jenkins-ssh-credential: '{jenkins-ssh-credential}'
302
303     builders:
304       - lf-infra-pre-build
305       - lf-jenkins-cfg-global-vars:
306           jenkins-silos: '{jenkins-silos}'
307       - lf-jenkins-cfg-clouds:
308           jenkins-silos: '{jenkins-silos}'
309
310     publishers:
311       - lf-infra-publish
312
313 - job-template:
314     name: '{project-name}-jenkins-cfg-merge'
315     id: gerrit-jenkins-cfg-merge
316     <<: *lf_jenkins_cfg_merge
317
318     scm:
319       - lf-infra-gerrit-scm:
320           git-url: '{git-url}'
321           refspec: 'refs/heads/{branch}'
322           branch: '{branch}'
323           submodule-recursive: true
324           choosing-strategy: default
325           jenkins-ssh-credential: '{jenkins-ssh-credential}'
326
327     triggers:
328       - timed: '{obj:cron}'
329       - gerrit:
330           server-name: '{gerrit-server-name}'
331           trigger-on: '{obj:gerrit_merge_triggers}'
332           projects:
333             - project-compare-type: ANT
334               project-pattern: '{project}'
335               branches:
336                 - branch-compare-type: ANT
337                   branch-pattern: '**/{branch}'
338               file-paths: '{obj:gerrit_trigger_file_paths}'
339
340 - job-template:
341     name: '{project-name}-jenkins-cfg-merge'
342     id: github-jenkins-cfg-merge
343     <<: *lf_jenkins_cfg_merge
344
345     properties:
346       - lf-infra-properties:
347           project: '{project}'
348           build-days-to-keep: 1
349       - github:
350           url: '{github-url}/{github-org}/{project}'
351
352     scm:
353       - lf-infra-github-scm:
354           url: '{git-clone-url}{github-org}/{project}'
355           refspec: ''
356           branch: 'refs/heads/{branch}'
357           submodule-recursive: true
358           choosing-strategy: default
359           jenkins-ssh-credential: '{jenkins-ssh-credential}'
360
361     triggers:
362       - timed: '{obj:cron}'
363       - github
364       - pollscm:
365           cron: ''
366       - github-pull-request:
367           trigger-phrase: '^remerge$'
368           only-trigger-phrase: true
369           status-context: 'Jenkins CFG Merge'
370           permit-all: true
371           github-hooks: true
372           org-list:
373             - '{github-org}'
374           white-list: '{obj:github_pr_whitelist}'
375           admin-list: '{obj:github_pr_admin_list}'
376           included-regions: '{obj:github_included_regions}'
377           white-list-target-branches:
378             - '{branch}'
379
380
381 ###########################
382 # JENKINS SANDBOX CLEANUP #
383 ###########################
384
385 - lf_jenkins_sandbox_cleanup: &lf_jenkins_sandbox_cleanup
386     name: lf-jenkins-sandbox-cleanup
387
388     ######################
389     # Default parameters #
390     ######################
391
392     build-timeout: 30
393     # Run every Saturday at 08:00 UTC
394     cron: '0 8 * * 6'
395     disable-job: false
396
397     #####################
398     # Job Configuration #
399     #####################
400
401     project-type: freestyle
402     node: '{build-node}'
403     concurrent: true
404     disabled: '{disable-job}'
405
406     parameters:
407       - lf-infra-jjb-parameters:
408           jjb-version: '{jjb-version}'
409
410     triggers:
411       - timed: '{obj:cron}'
412
413     builders:
414       - lf-infra-jjbini
415       - shell: !include-raw-escape:
416           - ../shell/jjb-install.sh
417           - ../shell/jenkins-sandbox-cleanup.sh
418           - ../shell/jjb-cleanup.sh
419
420 - job-template:
421     name: '{project-name}-jenkins-sandbox-cleanup'
422     id: gerrit-jenkins-sandbox-cleanup
423     <<: *lf_jjb_common
424     # yamllint disable-line rule:key-duplicates
425     <<: *lf_jenkins_sandbox_cleanup
426
427 - job-template:
428     name: '{project-name}-jenkins-sandbox-cleanup'
429     id: github-jenkins-sandbox-cleanup
430     <<: *lf_jjb_common
431     # yamllint disable-line rule:key-duplicates
432     <<: *lf_jenkins_sandbox_cleanup
433
434
435 ##################
436 # JJB DEPLOY JOB #
437 ##################
438
439 - lf_jjb_deploy_job: &lf_jjb_deploy_job
440     name: lf-jjb-deploy-job
441
442     ######################
443     # Default parameters #
444     ######################
445
446     branch: master
447     disable-job: false
448     # jjb-deploy should always clone $PROJECT regardless of what
449     # $GERRIT_PROJECT triggered the job.
450     git-url: '$GIT_URL/$PROJECT'
451     github-url: 'https://github.com'
452     stream: master
453     gerrit_jjb_deploy_job_triggers:
454       - comment-added-contains-event:
455           comment-contains-value: 'jjb-deploy[:]* (?!\*+$).+$'
456
457     #####################
458     # Job Configuration #
459     #####################
460
461     project-type: freestyle
462     node: '{build-node}'
463     concurrent: true
464     disabled: '{disable-job}'
465
466     properties:
467       - lf-infra-properties:
468           project: '{project}'
469           build-days-to-keep: 1
470
471     parameters:
472       - lf-infra-parameters:
473           project: '{project}'
474           stream: '{stream}'
475           branch: '{branch}'
476           lftools-version: '{lftools-version}'
477
478     wrappers:
479       - lf-infra-wrappers:
480           build-timeout: 5
481           jenkins-ssh-credential: '{jenkins-ssh-credential}'
482
483     builders:
484       - lf-pip-install:
485           pip-packages: jenkins-job-builder
486       - lf-infra-jjbini-sandbox
487       - shell: !include-raw-escape: ../shell/jjb-deploy-job.sh
488
489     publishers:
490       - lf-infra-publish
491
492 - job-template:
493     name: '{project-name}-jjb-deploy-job'
494     id: gerrit-jjb-deploy-job
495     <<: *lf_jjb_deploy_job
496
497     scm:
498       - lf-infra-gerrit-scm:
499           git-url: '{git-url}'
500           refspec: 'refs/heads/{branch}'
501           branch: '{branch}'
502           submodule-recursive: true
503           choosing-strategy: default
504           jenkins-ssh-credential: '{jenkins-ssh-credential}'
505
506     triggers:
507       - gerrit:
508           server-name: '{gerrit-server-name}'
509           trigger-on: '{obj:gerrit_jjb_deploy_job_triggers}'
510           projects:
511             - project-compare-type: ANT
512               project-pattern: '**'
513               branches:
514                 - branch-compare-type: ANT
515                   branch-pattern: '**'
516           skip-vote:
517             success: true
518             failed: true
519             unstable: true
520             notbuilt: true
521
522 - job-template:
523     name: '{project-name}-jjb-deploy-job'
524     id: github-jjb-deploy-job
525     <<: *lf_jjb_deploy_job
526
527     properties:
528       - lf-infra-properties:
529           project: '{project}'
530           build-days-to-keep: 1
531       - github:
532           url: '{github-url}/{github-org}/{project}'
533
534     scm:
535       - lf-infra-github-scm:
536           url: '{git-clone-url}{github-org}/{project}'
537           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
538           branch: '$sha1'
539           submodule-recursive: true
540           choosing-strategy: default
541           jenkins-ssh-credential: '{jenkins-ssh-credential}'
542
543     triggers:
544       - github-pull-request:
545           trigger-phrase: '^jjb-deploy (?!\*+$).+$'
546           only-trigger-phrase: true
547           status-context: 'JJB Deploy Job'
548           permit-all: true
549           github-hooks: true
550           white-list-target-branches:
551             - '{branch}'
552
553 #############
554 # JJB Merge #
555 #############
556
557 - lf_jjb_merge: &lf_jjb_merge
558     name: lf-jjb-merge
559
560     ######################
561     # Default parameters #
562     ######################
563
564     gerrit_merge_triggers:
565       - change-merged-event
566       - comment-added-contains-event:
567           comment-contains-value: remerge$
568
569     #####################
570     # Job Configuration #
571     #####################
572
573     builders:
574       - lf-infra-pre-build
575       - lf-infra-jjbini
576       - shell: !include-raw-escape:
577           - ../shell/jjb-install.sh
578           - ../shell/jjb-merge-job.sh
579           - ../shell/jjb-cleanup.sh
580
581 - job-template:
582     name: '{project-name}-jjb-merge'
583     id: gerrit-jjb-merge
584     <<: *lf_jjb_common
585     # yamllint disable-line rule:key-duplicates
586     <<: *lf_jjb_merge
587
588     git-url: '$GIT_URL/$GERRIT_PROJECT'
589
590     scm:
591       - lf-infra-gerrit-scm:
592           git-url: '{git-url}'
593           refspec: ''
594           branch: '{branch}'
595           submodule-recursive: '{submodule-recursive}'
596           choosing-strategy: default
597           jenkins-ssh-credential: '{jenkins-ssh-credential}'
598
599     triggers:
600       - gerrit:
601           server-name: '{gerrit-server-name}'
602           trigger-on: '{obj:gerrit_merge_triggers}'
603           projects:
604             - project-compare-type: ANT
605               project-pattern: '{project}'
606               branches:
607                 - branch-compare-type: ANT
608                   branch-pattern: '**/{branch}'
609               file-paths: '{obj:gerrit_trigger_file_paths}'
610
611 - job-template:
612     name: '{project-name}-jjb-merge'
613     id: github-jjb-merge
614     <<: *lf_jjb_common
615     # yamllint disable-line rule:key-duplicates
616     <<: *lf_jjb_merge
617
618     #####################
619     # Job Configuration #
620     #####################
621
622     properties:
623       - lf-infra-properties:
624           project: '{project}'
625           build-days-to-keep: 7
626       - github:
627           url: '{github-url}/{github-org}/{project}'
628
629     scm:
630       - lf-infra-github-scm:
631           url: '{git-clone-url}{github-org}/{project}'
632           refspec: ''
633           branch: 'refs/heads/{branch}'
634           submodule-recursive: '{submodule-recursive}'
635           choosing-strategy: default
636           jenkins-ssh-credential: '{jenkins-ssh-credential}'
637
638     triggers:
639       - github
640       - pollscm:
641           cron: ''
642       - github-pull-request:
643           trigger-phrase: '^remerge$'
644           only-trigger-phrase: true
645           status-context: 'JJB Merge'
646           permit-all: true
647           github-hooks: true
648           org-list:
649             - '{github-org}'
650           white-list: '{obj:github_pr_whitelist}'
651           admin-list: '{obj:github_pr_admin_list}'
652           included-regions: '{obj:github_included_regions}'
653           white-list-target-branches:
654             - '{branch}'
655
656 ##############
657 # JJB Verify #
658 ##############
659
660 - lf_jjb_verify: &lf_jjb_verify
661     name: lf-jjb-verify
662
663     ######################
664     # Default parameters #
665     ######################
666
667     gerrit_verify_triggers:
668       - patchset-created-event:
669           exclude-drafts: true
670           exclude-trivial-rebase: false
671           exclude-no-code-change: false
672       - draft-published-event
673       - comment-added-contains-event:
674           comment-contains-value: '^Patch Set[ ]+[0-9]+:([ ]+|[\n]+)(recheck|reverify)$'
675
676     #####################
677     # Job Configuration #
678     #####################
679
680     concurrent: true
681
682     builders:
683       - lf-infra-pre-build
684       - lf-infra-jjbini
685       - shell: !include-raw-escape:
686           - ../shell/git-validate-jira-urls.sh
687           - ../shell/jjb-install.sh
688           - ../shell/jjb-verify-job.sh
689           - ../shell/jjb-check-unicode.sh
690           - ../shell/jjb-cleanup.sh
691       - lf-infra-gpg-verify-git-signature
692
693 - job-template:
694     name: '{project-name}-jjb-verify'
695     id: gerrit-jjb-verify
696     <<: *lf_jjb_common
697     # yamllint disable-line rule:key-duplicates
698     <<: *lf_jjb_verify
699
700     ######################
701     # Default parameters #
702     ######################
703
704     git-url: '$GIT_URL/$GERRIT_PROJECT'
705
706     #####################
707     # Job Configuration #
708     #####################
709
710     scm:
711       - lf-infra-gerrit-scm:
712           git-url: '{git-url}'
713           refspec: '$GERRIT_REFSPEC'
714           branch: '$GERRIT_BRANCH'
715           submodule-recursive: '{submodule-recursive}'
716           choosing-strategy: gerrit
717           jenkins-ssh-credential: '{jenkins-ssh-credential}'
718
719     triggers:
720       - gerrit:
721           server-name: '{gerrit-server-name}'
722           trigger-on: '{obj:gerrit_verify_triggers}'
723           projects:
724             - project-compare-type: ANT
725               project-pattern: '{project}'
726               branches:
727                 - branch-compare-type: ANT
728                   branch-pattern: '**/{branch}'
729               file-paths: '{obj:gerrit_trigger_file_paths}'
730
731 - job-template:
732     name: '{project-name}-jjb-verify'
733     id: github-jjb-verify
734     <<: *lf_jjb_common
735     # yamllint disable-line rule:key-duplicates
736     <<: *lf_jjb_verify
737
738     #####################
739     # Job Configuration #
740     #####################
741
742     properties:
743       - lf-infra-properties:
744           project: '{project}'
745           build-days-to-keep: 7
746       - github:
747           url: '{github-url}/{github-org}/{project}'
748
749     scm:
750       - lf-infra-github-scm:
751           url: '{git-clone-url}{github-org}/{project}'
752           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
753           branch: '$sha1'
754           submodule-recursive: '{submodule-recursive}'
755           choosing-strategy: default
756           jenkins-ssh-credential: '{jenkins-ssh-credential}'
757
758     triggers:
759       - github-pull-request:
760           trigger-phrase: '^(recheck|reverify)$'
761           only-trigger-phrase: false
762           status-context: 'JJB Verify'
763           permit-all: true
764           github-hooks: true
765           included-regions: '{obj:github_included_regions}'
766           white-list-target-branches:
767             - '{branch}'
768
769 ############################
770 # JJB Verify Upstream GJJB #
771 ############################
772
773 - lf_jjb_verify: &lf_jjb_verify_upstream_gjjb
774     name: lf-jjb-verify-upstream-gjjb
775
776     #####################
777     # Job Configuration #
778     #####################
779
780     concurrent: true
781
782     builders:
783       - shell: |
784           cd jjb/global-jjb
785           git fetch https://gerrit.linuxfoundation.org/infra/releng/global-jjb $GERRIT_REFSPEC
786           git cherry-pick FETCH_HEAD
787       - lf-infra-jjbini
788       - shell: !include-raw-escape:
789           - ../shell/git-validate-jira-urls.sh
790           - ../shell/jjb-install.sh
791           - ../shell/jjb-verify-job.sh
792           - ../shell/jjb-check-unicode.sh
793           - ../shell/jjb-cleanup.sh
794       - lf-infra-gpg-verify-git-signature
795
796 - job-template:
797     name: '{project-name}-jjb-verify-upstream-gjjb'
798     id: gerrit-jjb-verify-upstream-gjjb
799     <<: *lf_jjb_common
800     # yamllint disable-line rule:key-duplicates
801     <<: *lf_jjb_verify_upstream_gjjb
802
803     ######################
804     # Default parameters #
805     ######################
806
807     git-url: '$GIT_URL/$PROJECT'
808
809     #####################
810     # Job Configuration #
811     #####################
812
813     scm:
814       - lf-infra-gerrit-scm:
815           git-url: '{git-url}'
816           refspec: ''
817           branch: 'master'
818           submodule-recursive: true
819           choosing-strategy: default
820           jenkins-ssh-credential: '{jenkins-ssh-credential}'
821
822     triggers:
823       - gerrit:
824           server-name: 'LinuxFoundation'
825           trigger-on:
826             - patchset-created-event:
827                 exclude-drafts: true
828                 exclude-trivial-rebase: false
829                 exclude-no-code-change: false
830             - draft-published-event
831             - comment-added-contains-event:
832                 comment-contains-value: '^Patch Set[ ]+[0-9]+:([ ]+|[\n]+)(recheck|reverify)$'
833           projects:
834             - project-compare-type: ANT
835               project-pattern: 'releng/global-jjb'
836               branches:
837                 - branch-compare-type: ANT
838                   branch-pattern: '**/master'
839           override-votes: true
840           gerrit-build-failed-codereview-value: -1
841           gerrit-build-failed-verified-value: 0
842           gerrit-build-successful-codereview-value: 1
843           gerrit-build-successful-verified-value: 0
844
845 #################
846 # License Check #
847 #################
848
849 - lf_license_check: &lf_license_check
850     name: lf-license-check
851
852     ######################
853     # Default parameters #
854     ######################
855
856     branch: master
857     build-days-to-keep: 7
858     build-timeout: 15
859     disable-job: false
860     file-patterns: >
861         *.go
862         *.groovy
863         *.java
864         *.py
865         *.sh
866     git-url: '$GIT_URL/$PROJECT'
867     github-url: 'https://github.com'
868     lhc-version: 0.2.0
869     license-exclude-paths: ''
870     licenses-allowed: Apache-2.0,EPL-1.0,MIT
871     project-pattern: '**'
872     spdx-disable: false
873     stream: master
874
875     #####################
876     # Job Configuration #
877     #####################
878
879     project-type: freestyle
880     node: '{build-node}'
881     concurrent: true
882     disabled: '{disable-job}'
883
884     properties:
885       - lf-infra-properties:
886           build-days-to-keep: '{build-days-to-keep}'
887
888     parameters:
889       - lf-infra-parameters:
890           project: '{project}'
891           branch: '{branch}'
892           stream: '{stream}'
893           lftools-version: '{lftools-version}'
894
895     wrappers:
896       - lf-infra-wrappers:
897           build-timeout: '{build-timeout}'
898           jenkins-ssh-credential: '{jenkins-ssh-credential}'
899
900     builders:
901       - lf-license-check:
902           file-patterns: '{file-patterns}'
903           spdx-disable: '{spdx-disable}'
904           lhc-version: '{lhc-version}'
905           license-exclude-paths: '{license-exclude-paths}'
906           licenses-allowed: '{licenses-allowed}'
907
908     publishers:
909       - lf-infra-publish
910
911 - job-template:
912     name: '{project-name}-license-check'
913     id: gerrit-license-check
914     <<: *lf_license_check
915
916     git-url: '$GIT_URL/$GERRIT_PROJECT'
917
918     scm:
919       - lf-infra-gerrit-scm:
920           git-url: '{git-url}'
921           refspec: '$GERRIT_REFSPEC'
922           branch: '$GERRIT_BRANCH'
923           # Submodules are out of the project's control
924           submodule-recursive: false
925           choosing-strategy: gerrit
926           jenkins-ssh-credential: '{jenkins-ssh-credential}'
927
928     triggers:
929       - gerrit:
930           server-name: '{gerrit-server-name}'
931           # Trigger should not be overridable as we want to always run
932           trigger-on:
933             - patchset-created-event:
934                 exclude-drafts: false
935                 exclude-trivial-rebase: false
936                 exclude-no-code-change: false
937             - draft-published-event
938             - comment-added-contains-event:
939                 comment-contains-value: recheck$
940           projects:
941             - project-compare-type: ANT
942               project-pattern: '{project-pattern}'
943               branches:
944                 - branch-compare-type: ANT
945                   branch-pattern: '**'
946
947 - job-template:
948     name: '{project-name}-license-check'
949     id: github-license-check
950     <<: *lf_license_check
951
952     properties:
953       - lf-infra-properties:
954           build-days-to-keep: '{build-days-to-keep}'
955       - github:
956           url: '{github-url}/{github-org}/{project}'
957
958     scm:
959       - lf-infra-github-scm:
960           url: '{git-clone-url}{github-org}/{project}'
961           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
962           branch: '$sha1'
963           # Submodules are out of the project's control
964           submodule-recursive: false
965           choosing-strategy: default
966           jenkins-ssh-credential: '{jenkins-ssh-credential}'
967
968     triggers:
969       - github-pull-request:
970           trigger-phrase: '^recheck$'
971           only-trigger-phrase: false
972           status-context: 'License Check'
973           permit-all: true
974           github-hooks: true
975           white-list-target-branches:
976             - '{branch}'
977
978 ####################
979 # Info YAML Verify #
980 ####################
981
982 - lf_info_yaml_verify: &lf_info_yaml_verify
983     name: lf-info-yaml-verify
984
985     ######################
986     # Default parameters #
987     ######################
988
989     gerrit_verify_triggers:
990       - patchset-created-event:
991           exclude-drafts: true
992           exclude-trivial-rebase: false
993           exclude-no-code-change: false
994       - draft-published-event
995       - comment-added-contains-event:
996           comment-contains-value: '^Patch Set[ ]+[0-9]+:([ ]+|[\n]+)(recheck|reverify)$'
997
998     #####################
999     # Job Configuration #
1000     #####################
1001
1002     concurrent: true
1003
1004     builders:
1005       - shell: !include-raw-escape:
1006           - ../shell/git-validate-info-yaml.sh
1007           - ../shell/info-file-validate.sh
1008
1009 - job-template:
1010     name: '{project-name}-info-yaml-verify'
1011     id: gerrit-info-yaml-verify
1012     <<: *lf_jjb_common
1013     # yamllint disable-line rule:key-duplicates
1014     <<: *lf_info_yaml_verify
1015
1016     git-url: '$GIT_URL/$GERRIT_PROJECT'
1017
1018     scm:
1019       - lf-infra-gerrit-scm:
1020           git-url: '{git-url}'
1021           refspec: '$GERRIT_REFSPEC'
1022           branch: '$GERRIT_BRANCH'
1023           submodule-recursive: '{submodule-recursive}'
1024           choosing-strategy: gerrit
1025           jenkins-ssh-credential: '{jenkins-ssh-credential}'
1026
1027     triggers:
1028       - gerrit:
1029           server-name: '{gerrit-server-name}'
1030           trigger-on: '{obj:gerrit_verify_triggers}'
1031           projects:
1032             - project-compare-type: ANT
1033               project-pattern: '{project}'
1034               branches:
1035                 - branch-compare-type: ANT
1036                   branch-pattern: '**/{branch}'
1037               file-paths:
1038                 - compare-type: REG_EXP
1039                   pattern: 'INFO.yaml'
1040
1041 - job-template:
1042     name: '{project-name}-info-yaml-verify'
1043     id: github-info-yaml-verify
1044     <<: *lf_jjb_common
1045     # yamllint disable-line rule:key-duplicates
1046     <<: *lf_info_yaml_verify
1047
1048     github-url: 'https://github.com'
1049     properties:
1050       - github:
1051           url: '{github-url}/{github-org}/{project}'
1052
1053     scm:
1054       - lf-infra-github-scm:
1055           url: '{git-clone-url}{github-org}/{project}'
1056           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
1057           branch: '$sha1'
1058           submodule-recursive: '{submodule-recursive}'
1059           choosing-strategy: default
1060           jenkins-ssh-credential: '{jenkins-ssh-credential}'
1061
1062     triggers:
1063       - github-pull-request:
1064           trigger-phrase: '^(recheck|reverify)$'
1065           only-trigger-phrase: false
1066           status-context: 'INFO File Verify'
1067           permit-all: true
1068           github-hooks: true
1069           # included-regions MUST match gerrit file-paths
1070           included-regions: 'INFO.yaml'
1071           white-list-target-branches:
1072             - '{branch}'
1073
1074 ##################
1075 # OPENSTACK CRON #
1076 ##################
1077
1078 - lf_openstack_cron: &lf_openstack_cron
1079     name: lf-openstack-cron
1080
1081     ######################
1082     # Default parameters #
1083     ######################
1084
1085     branch: master
1086     build-days-to-keep: 7
1087     build-timeout: 10
1088     cron: '@daily'
1089     disable-job: false
1090     git-url: '$GIT_URL/$PROJECT'
1091     github-url: 'https://github.com'
1092     openstack-cloud: vex
1093     stream: master
1094
1095     #####################
1096     # Job Configuration #
1097     #####################
1098
1099     project-type: freestyle
1100     node: '{build-node}'
1101     concurrent: false
1102     disabled: '{disable-job}'
1103
1104     properties:
1105       - lf-infra-properties:
1106           build-days-to-keep: '{build-days-to-keep}'
1107
1108     parameters:
1109       - lf-infra-parameters:
1110           project: '{project}'
1111           stream: '{stream}'
1112           branch: '{branch}'
1113           lftools-version: '{lftools-version}'
1114
1115     wrappers:
1116       - lf-infra-wrappers:
1117           build-timeout: '{build-timeout}'
1118           jenkins-ssh-credential: '{jenkins-ssh-credential}'
1119       # Listed after to override openstack-infra-wrappers clouds.yaml definition
1120       - config-file-provider:
1121           files:
1122             - file-id: clouds-yaml
1123               target: '$HOME/.config/openstack/clouds.yaml'
1124             - file-id: npmrc
1125               target: '$HOME/.npmrc'
1126             - file-id: pipconf
1127               target: '$HOME/.config/pip/pip.conf'
1128
1129     triggers:
1130       - timed: '{obj:cron}'
1131
1132     builders:
1133       - inject:
1134           properties-content: OS_CLOUD={openstack-cloud}
1135       - shell: !include-raw-escape: ../shell/openstack-install.sh
1136       - shell: !include-raw-escape: ../shell/openstack-protect-in-use-images.sh
1137
1138     publishers:
1139       - lf-infra-publish
1140
1141 - job-template:
1142     name: '{project-name}-openstack-cron'
1143     id: gerrit-openstack-cron
1144     <<: *lf_openstack_cron
1145
1146     scm:
1147       - lf-infra-gerrit-scm:
1148           git-url: '{git-url}'
1149           refspec: 'refs/heads/{branch}'
1150           branch: '{branch}'
1151           submodule-recursive: true
1152           choosing-strategy: default
1153           jenkins-ssh-credential: '{jenkins-ssh-credential}'
1154
1155 - job-template:
1156     name: '{project-name}-openstack-cron'
1157     id: github-openstack-cron
1158     <<: *lf_openstack_cron
1159
1160     scm:
1161       - lf-infra-github-scm:
1162           url: '{git-clone-url}{github-org}/{project}'
1163           refspec: ''
1164           branch: 'refs/heads/{branch}'
1165           submodule-recursive: true
1166           choosing-strategy: default
1167           jenkins-ssh-credential: '{jenkins-ssh-credential}'
1168
1169 ################
1170 # Packer Merge #
1171 ################
1172
1173 - lf_packer_merge: &lf_packer_merge
1174     name: lf-packer-merge
1175
1176     ######################
1177     # Default parameters #
1178     ######################
1179
1180     openstack: true
1181     openstack-cloud: vex
1182
1183     #####################
1184     # Job Configuration #
1185     #####################
1186
1187     parameters:
1188       - lf-infra-parameters:
1189           project: '{project}'
1190           stream: '{stream}'
1191           branch: '{branch}'
1192           lftools-version: '{lftools-version}'
1193       - lf-packer-parameters:
1194           packer-version: '{packer-version}'
1195
1196     builders:
1197       - lf-infra-packer-build:
1198           openstack: '{openstack}'
1199           openstack-cloud: '{openstack-cloud}'
1200           packer-cloud-settings: '{packer-cloud-settings}'
1201           packer-version: '{packer-version}'
1202           platform: '{platforms}'
1203           template: '{templates}'
1204
1205 - job-template:
1206     name: '{project-name}-packer-merge-{platforms}-{templates}'
1207     id: gerrit-packer-merge
1208     <<: *lf_packer_common
1209     # yamllint disable-line rule:key-duplicates
1210     <<: *lf_packer_merge
1211
1212     ######################
1213     # Default parameters #
1214     ######################
1215
1216     git-url: '$GIT_URL/$GERRIT_PROJECT'
1217
1218     gerrit_merge_triggers:
1219       - change-merged-event
1220       - comment-added-contains-event:
1221           comment-contains-value: remerge$
1222
1223     #####################
1224     # Job Configuration #
1225     #####################
1226
1227     scm:
1228       - lf-infra-gerrit-scm:
1229           git-url: '{git-url}'
1230           refspec: '$GERRIT_REFSPEC'
1231           branch: '$GERRIT_BRANCH'
1232           submodule-recursive: '{submodule-recursive}'
1233           choosing-strategy: gerrit
1234           jenkins-ssh-credential: '{jenkins-ssh-credential}'
1235
1236     triggers:
1237       - timed: '{obj:cron}'
1238       - gerrit:
1239           server-name: '{gerrit-server-name}'
1240           trigger-on: '{obj:gerrit_merge_triggers}'
1241           projects:
1242             - project-compare-type: ANT
1243               project-pattern: '{project}'
1244               branches:
1245                 - branch-compare-type: ANT
1246                   branch-pattern: '**/{branch}'
1247               file-paths:
1248                 - compare-type: REG_EXP
1249                   pattern: 'packer\/provision\/.*\.sh'
1250                 - compare-type: REG_EXP
1251                   pattern: 'packer\/provision\/.*\.bat'
1252                 - compare-type: REG_EXP
1253                   pattern: 'packer\/provision\/.*\.ps1'
1254                 - compare-type: REG_EXP
1255                   pattern: 'packer\/provision\/{templates}\.yaml'
1256                 - compare-type: REG_EXP
1257                   pattern: 'packer\/provision\/local-{templates}\.yaml'
1258                 - compare-type: REG_EXP
1259                   pattern: 'packer\/templates\/{templates}\.json'
1260                 - compare-type: REG_EXP
1261                   pattern: 'packer\/vars\/{platforms}\.json'
1262
1263 - job-template:
1264     name: '{project-name}-packer-merge-{platforms}-{templates}'
1265     id: github-packer-merge
1266     <<: *lf_packer_common
1267     # yamllint disable-line rule:key-duplicates
1268     <<: *lf_packer_merge
1269
1270     #####################
1271     # Job Configuration #
1272     #####################
1273
1274     properties:
1275       - lf-infra-properties:
1276           project: '{project}'
1277           build-days-to-keep: 7
1278       - github:
1279           url: '{github-url}/{github-org}/{project}'
1280
1281     scm:
1282       - lf-infra-github-scm:
1283           url: '{git-clone-url}{github-org}/{project}'
1284           refspec: ''
1285           branch: 'refs/heads/{branch}'
1286           submodule-recursive: '{submodule-recursive}'
1287           choosing-strategy: default
1288           jenkins-ssh-credential: '{jenkins-ssh-credential}'
1289
1290     triggers:
1291       - timed: '{obj:cron}'
1292       - github
1293       - pollscm:
1294           cron: ''
1295
1296       - github-pull-request:
1297           trigger-phrase: '^remerge$'
1298           only-trigger-phrase: true
1299           status-context: 'Packer {platforms}-{templates} Merge'
1300           permit-all: true
1301           github-hooks: true
1302           org-list:
1303             - '{github-org}'
1304           white-list: '{obj:github_pr_whitelist}'
1305           admin-list: '{obj:github_pr_admin_list}'
1306           # included-regions MUST match Gerrit Trigger file-paths
1307           included-regions:
1308             - 'packer\/provision\/.*\.sh'
1309             - 'packer\/provision\/.*\.bat'
1310             - 'packer\/provision\/.*\.ps1'
1311             - 'packer\/provision\/{templates}\.yaml'
1312             - 'packer\/provision\/local-{templates}\.yaml'
1313             - 'packer\/templates\/{templates}\.json'
1314             - 'packer\/vars\/{platforms}\.json'
1315           white-list-target-branches:
1316             - '{branch}'
1317
1318 #################
1319 # Packer Verify #
1320 #################
1321
1322 - lf_packer_verify: &lf_packer_verify
1323     name: lf-packer-verify
1324
1325     ######################
1326     # Default parameters #
1327     ######################
1328
1329     build-timeout: 10
1330
1331     gerrit_verify_triggers:
1332       - patchset-created-event:
1333           exclude-drafts: true
1334           exclude-trivial-rebase: false
1335           exclude-no-code-change: false
1336       - draft-published-event
1337       - comment-added-contains-event:
1338           comment-contains-value: '^Patch Set[ ]+[0-9]+:([ ]+|[\n]+)(recheck|reverify)$'
1339
1340     gerrit_trigger_file_paths:
1341       - compare-type: REG_EXP
1342         pattern: 'packer\/.*'
1343
1344     # github_included_regions MUST match gerrit_trigger_file_paths
1345     github_included_regions:
1346       - 'packer\/.*'
1347
1348     #####################
1349     # Job Configuration #
1350     #####################
1351
1352     concurrent: true
1353
1354     builders:
1355       - lf-infra-packer-validate:
1356           packer-cloud-settings: '{packer-cloud-settings}'
1357           packer-version: '{packer-version}'
1358
1359 - job-template:
1360     name: '{project-name}-packer-verify'
1361     id: gerrit-packer-verify
1362     <<: *lf_packer_common
1363     # yamllint disable-line rule:key-duplicates
1364     <<: *lf_packer_verify
1365
1366     ######################
1367     # Default parameters #
1368     ######################
1369
1370     git-url: '$GIT_URL/$GERRIT_PROJECT'
1371
1372     #####################
1373     # Job Configuration #
1374     #####################
1375
1376     scm:
1377       - lf-infra-gerrit-scm:
1378           git-url: '{git-url}'
1379           refspec: '$GERRIT_REFSPEC'
1380           branch: '$GERRIT_BRANCH'
1381           submodule-recursive: '{submodule-recursive}'
1382           choosing-strategy: gerrit
1383           jenkins-ssh-credential: '{jenkins-ssh-credential}'
1384
1385     triggers:
1386       - gerrit:
1387           server-name: '{gerrit-server-name}'
1388           trigger-on: '{obj:gerrit_verify_triggers}'
1389           projects:
1390             - project-compare-type: ANT
1391               project-pattern: '{project}'
1392               branches:
1393                 - branch-compare-type: ANT
1394                   branch-pattern: '**/{branch}'
1395               file-paths: '{obj:gerrit_trigger_file_paths}'
1396
1397 - job-template:
1398     name: '{project-name}-packer-verify'
1399     id: github-packer-verify
1400     <<: *lf_packer_common
1401     # yamllint disable-line rule:key-duplicates
1402     <<: *lf_packer_verify
1403
1404     #####################
1405     # Job Configuration #
1406     #####################
1407
1408     properties:
1409       - lf-infra-properties:
1410           project: '{project}'
1411           build-days-to-keep: 7
1412       - github:
1413           url: '{github-url}/{github-org}/{project}'
1414
1415     scm:
1416       - lf-infra-github-scm:
1417           url: '{git-clone-url}{github-org}/{project}'
1418           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
1419           branch: '$sha1'
1420           submodule-recursive: '{submodule-recursive}'
1421           choosing-strategy: default
1422           jenkins-ssh-credential: '{jenkins-ssh-credential}'
1423
1424     triggers:
1425       - github-pull-request:
1426           trigger-phrase: '^(recheck|reverify)$'
1427           only-trigger-phrase: false
1428           status-context: 'Packer Verify'
1429           permit-all: true
1430           github-hooks: true
1431           included-regions: '{obj:github_included_regions}'
1432           white-list-target-branches:
1433             - '{branch}'