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