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