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