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