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