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