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