Merge "Split maven-deploy into a macro"
[releng/global-jjb.git] / jjb / lf-ci-jobs.yaml
1 ---
2 - job-group:
3     name: '{project-name}-ci-jobs'
4
5     jobs:
6       - gerrit-jjb-deploy-job
7       - gerrit-jjb-merge
8       - gerrit-jjb-verify
9
10 - job-group:
11     name: '{project-name}-github-ci-jobs'
12
13     jobs:
14       - github-jjb-deploy-job
15       - github-jjb-merge
16       - github-jjb-verify
17
18 - job-group:
19     name: '{project-name}-packer-jobs'
20
21     packer-version: 1.1.3
22
23     jobs:
24       - gerrit-packer-merge
25       - gerrit-packer-verify
26
27
28 - job-group:
29     name: '{project-name}-github-packer-jobs'
30
31     packer-version: 1.1.3
32
33     jobs:
34       - github-packer-merge
35       - github-packer-verify
36
37 ####################
38 # COMMON FUNCTIONS #
39 ####################
40
41 - builder:
42     name: lf-infra-jjbini
43     builders:
44       - config-file-provider:
45           files:
46             - file-id: jjbini
47               target: '$HOME/.config/jenkins_jobs/jenkins_jobs.ini'
48
49 - builder:
50     name: lf-infra-jjbini-sandbox
51     # TODO: Consolidate this into jjbini when JJB2.0 is available.
52     builders:
53       - config-file-provider:
54           files:
55             - file-id: jjbini-sandbox
56               target: '$HOME/.config/jenkins_jobs/jenkins_jobs.ini'
57
58 - lf_packer_file_paths: &lf_packer_file_paths
59     name: lf-packer-file-paths
60     file-paths:
61       - compare-type: ANT
62         pattern: 'packer/vars/{platforms}.json'
63       - compare-type: ANT
64         pattern: 'packer/templates/{templates}.json'
65       - compare-type: ANT
66         pattern: 'packer/provision/*.sh'
67       - compare-type: ANT
68         pattern: 'packer/provision/{templates}.yaml'
69       - compare-type: ANT
70         pattern: 'packer/provision/lib/**'
71
72 - lf_packer: &lf_packer_common
73     name: lf-packer-common
74     # Provide configuration common in packer jobs.
75
76     ######################
77     # Default parameters #
78     ######################
79
80     branch: master
81     build-timeout: 90
82     stream: master
83     submodule-recursive: true
84     packer-cloud-settings: packer-cloud-env
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-infra-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-infra-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     jjb-version: 1.6.2
141     stream: master
142     submodule-recursive: true
143
144     gerrit_trigger_file_paths:
145       - compare-type: ANT
146         pattern: '**/*.sh'
147       - compare-type: ANT
148         pattern: '**/*.yaml'
149       - compare-type: ANT
150         pattern: '**/global-jjb'
151
152     #####################
153     # Job Configuration #
154     #####################
155
156     project-type: freestyle
157     node: '{build-node}'
158
159     properties:
160       - lf-infra-properties:
161           project: '{project}'
162           build-days-to-keep: 7
163
164     parameters:
165       - lf-infra-parameters:
166           project: '{project}'
167           stream: '{stream}'
168           branch: '{branch}'
169           lftools-version: '{lftools-version}'
170       - lf-infra-jjb-parameters:
171           jjb-version: '{jjb-version}'
172
173     wrappers:
174       - lf-infra-wrappers:
175           build-timeout: '{build-timeout}'
176           jenkins-ssh-credential: '{jenkins-ssh-credential}'
177
178     publishers:
179       - lf-infra-publish
180
181 ######################
182 # Gerrit Branch Lock #
183 ######################
184
185 - job-template:
186     name: '{project-name}-gerrit-branch-lock-{stream}'
187     id: gerrit-branch-lock
188
189     ######################
190     # Default parameters #
191     ######################
192
193     branch: master
194     git-url: '$GIT_URL/$GERRIT_PROJECT'
195     stream: master
196     gerrit_merge_triggers:
197       - comment-added-contains-event:
198           comment-contains-value: (un)?lock branch$
199
200     #####################
201     # Job Configuration #
202     #####################
203
204     project-type: freestyle
205     node: '{build-node}'
206
207     properties:
208       - lf-infra-properties:
209           project: '{project}'
210           build-days-to-keep: 1
211
212     parameters:
213       - lf-infra-parameters:
214           project: '{project}'
215           stream: '{stream}'
216           branch: '{branch}'
217           lftools-version: '{lftools-version}'
218
219     wrappers:
220       - lf-infra-wrappers:
221           build-timeout: 5
222           jenkins-ssh-credential: '{jenkins-ssh-credential}'
223
224     scm:
225       - lf-infra-gerrit-scm:
226           git-url: '{git-url}'
227           refspec: ''
228           branch: '{branch}'
229           submodule-recursive: false
230           choosing-strategy: default
231           jenkins-ssh-credential: '{jenkins-ssh-credential}'
232
233     triggers:
234       - gerrit:
235           server-name: '{gerrit-server-name}'
236           trigger-on: '{obj:gerrit_merge_triggers}'
237           projects:
238             - project-compare-type: ANT
239               project-pattern: '{project}'
240               branches:
241                 - branch-compare-type: ANT
242                   branch-pattern: '**/{branch}'
243
244     builders:
245       - shell: !include-raw-escape: ../shell/gerrit-branch-lock.sh
246
247
248     publishers:
249       - lf-infra-publish
250
251 ##################
252 # JJB DEPLOY JOB #
253 ##################
254
255 - lf_jjb_deploy_job: &lf_jjb_deploy_job
256     name: lf-jjb-deploy-job
257
258     ######################
259     # Default parameters #
260     ######################
261
262     branch: master
263     git-url: '$GIT_URL/$GERRIT_PROJECT'
264     stream: master
265     gerrit_jjb_deploy_job_triggers:
266       - comment-added-contains-event:
267           comment-contains-value: jjb-deploy (?!\*+$).+$
268
269     #####################
270     # Job Configuration #
271     #####################
272
273     project-type: freestyle
274     node: '{build-node}'
275     concurrent: true
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: '{stream}'
286           branch: '{branch}'
287           lftools-version: '{lftools-version}'
288
289     wrappers:
290       - lf-infra-wrappers:
291           build-timeout: 5
292           jenkins-ssh-credential: '{jenkins-ssh-credential}'
293
294     builders:
295       - lf-pip-install:
296           pip-packages: jenkins-job-builder
297       - lf-infra-jjbini-sandbox
298       - shell: !include-raw-escape: ../shell/jjb-deploy-job.sh
299
300     publishers:
301       - lf-infra-publish
302
303 - job-template:
304     name: '{project-name}-jjb-deploy-job'
305     id: gerrit-jjb-deploy-job
306     <<: *lf_jjb_deploy_job
307
308     scm:
309       - lf-infra-gerrit-scm:
310           git-url: '{git-url}'
311           refspec: 'refs/heads/{branch}'
312           branch: '{branch}'
313           submodule-recursive: true
314           choosing-strategy: default
315           jenkins-ssh-credential: '{jenkins-ssh-credential}'
316
317     triggers:
318       - gerrit:
319           server-name: '{gerrit-server-name}'
320           trigger-on: '{obj:gerrit_jjb_deploy_job_triggers}'
321           projects:
322             - project-compare-type: ANT
323               project-pattern: '{project}'
324               branches:
325                 - branch-compare-type: ANT
326                   branch-pattern: '**/{branch}'
327
328 - job-template:
329     name: '{project-name}-jjb-deploy-job'
330     id: github-jjb-deploy-job
331     <<: *lf_jjb_deploy_job
332
333     properties:
334       - github:
335           url: '{git-url}/{github-org}/{project}'
336
337     scm:
338       - lf-infra-github-scm:
339           url: '{git-clone-url}{github-org}/{project}'
340           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
341           branch: '$sha1'
342           submodule-recursive: true
343           choosing-strategy: default
344           jenkins-ssh-credential: '{jenkins-ssh-credential}'
345
346     triggers:
347       - lf-infra-github-pr-trigger:
348           trigger-phrase: '^jjb-deploy (?!\*+$).+$'
349           only-trigger-phrase: true
350           status-context: 'JJB Deploy Job'
351           permit-all: true
352           github-hooks: true
353           github-org: ''
354           github_pr_whitelist:
355             - ''
356           github_pr_admin_list:
357             - ''
358
359 #############
360 # JJB Merge #
361 #############
362
363 - lf_jjb_merge: &lf_jjb_merge
364     name: lf-jjb-merge
365
366     ######################
367     # Default parameters #
368     ######################
369
370     gerrit_merge_triggers:
371       - change-merged-event
372       - comment-added-contains-event:
373           comment-contains-value: remerge$
374
375     #####################
376     # Job Configuration #
377     #####################
378
379     builders:
380       - lf-infra-jjbini
381       - shell: !include-raw-escape:
382           - ../shell/jjb-install.sh
383           - ../shell/jjb-merge-job.sh
384
385 - job-template:
386     name: '{project-name}-jjb-merge'
387     id: gerrit-jjb-merge
388     <<: *lf_jjb_common
389     # yamllint disable-line rule:key-duplicates
390     <<: *lf_jjb_merge
391
392     git-url: '$GIT_URL/$GERRIT_PROJECT'
393
394     scm:
395       - lf-infra-gerrit-scm:
396           git-url: '{git-url}'
397           refspec: ''
398           branch: '{branch}'
399           submodule-recursive: '{submodule-recursive}'
400           choosing-strategy: default
401           jenkins-ssh-credential: '{jenkins-ssh-credential}'
402
403     triggers:
404       - gerrit:
405           server-name: '{gerrit-server-name}'
406           trigger-on: '{obj:gerrit_merge_triggers}'
407           projects:
408             - project-compare-type: ANT
409               project-pattern: '{project}'
410               branches:
411                 - branch-compare-type: ANT
412                   branch-pattern: '**/{branch}'
413               file-paths: '{obj:gerrit_trigger_file_paths}'
414
415 - job-template:
416     name: '{project-name}-jjb-merge'
417     id: github-jjb-merge
418     <<: *lf_jjb_common
419     # yamllint disable-line rule:key-duplicates
420     <<: *lf_jjb_merge
421
422     properties:
423       - github:
424           url: '{git-url}/{github-org}/{project}'
425
426     scm:
427       - lf-infra-github-scm:
428           url: '{git-clone-url}{github-org}/{project}'
429           refspec: ''
430           branch: 'refs/heads/{branch}'
431           submodule-recursive: '{submodule-recursive}'
432           choosing-strategy: default
433           jenkins-ssh-credential: '{jenkins-ssh-credential}'
434
435     triggers:
436       - github
437       - pollscm:
438           cron: ''
439       - lf-infra-github-pr-trigger:
440           trigger-phrase: '^remerge$'
441           only-trigger-phrase: true
442           status-context: 'JJB Merge'
443           permit-all: false
444           github-hooks: true
445           github-org: '{github-org}'
446           github_pr_whitelist: '{obj:github_pr_whitelist}'
447           github_pr_admin_list: '{obj:github_pr_admin_list}'
448
449 ##############
450 # JJB Verify #
451 ##############
452
453 - lf_jjb_verify: &lf_jjb_verify
454     name: lf-jjb-verify
455
456     ######################
457     # Default parameters #
458     ######################
459
460     gerrit_verify_triggers:
461       - patchset-created-event:
462           exclude-drafts: true
463           exclude-trivial-rebase: false
464           exclude-no-code-change: false
465       - draft-published-event
466       - comment-added-contains-event:
467           comment-contains-value: recheck$
468
469     #####################
470     # Job Configuration #
471     #####################
472
473     concurrent: true
474
475     builders:
476       - lf-infra-jjbini
477       - shell: !include-raw-escape:
478           - ../shell/git-validate-jira-urls.sh
479           - ../shell/jjb-install.sh
480           - ../shell/jjb-verify-job.sh
481           - ../shell/jjb-check-unicode.sh
482       - lf-infra-gpg-verify-git-signature
483
484 - job-template:
485     name: '{project-name}-jjb-verify'
486     id: gerrit-jjb-verify
487     <<: *lf_jjb_common
488     # yamllint disable-line rule:key-duplicates
489     <<: *lf_jjb_verify
490
491     git-url: '$GIT_URL/$GERRIT_PROJECT'
492
493     scm:
494       - lf-infra-gerrit-scm:
495           git-url: '{git-url}'
496           refspec: '$GERRIT_REFSPEC'
497           branch: '$GERRIT_BRANCH'
498           submodule-recursive: '{submodule-recursive}'
499           choosing-strategy: gerrit
500           jenkins-ssh-credential: '{jenkins-ssh-credential}'
501
502     triggers:
503       - gerrit:
504           server-name: '{gerrit-server-name}'
505           trigger-on: '{obj:gerrit_verify_triggers}'
506           projects:
507             - project-compare-type: ANT
508               project-pattern: '{project}'
509               branches:
510                 - branch-compare-type: ANT
511                   branch-pattern: '**/{branch}'
512               file-paths: '{obj:gerrit_trigger_file_paths}'
513
514 - job-template:
515     name: '{project-name}-jjb-verify'
516     id: github-jjb-verify
517     <<: *lf_jjb_common
518     # yamllint disable-line rule:key-duplicates
519     <<: *lf_jjb_verify
520
521     properties:
522       - github:
523           url: '{git-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: '{submodule-recursive}'
531           choosing-strategy: default
532           jenkins-ssh-credential: '{jenkins-ssh-credential}'
533
534     triggers:
535       - lf-infra-github-pr-trigger:
536           trigger-phrase: '^recheck$'
537           only-trigger-phrase: false
538           status-context: 'JJB Verify'
539           permit-all: true
540           github-hooks: true
541           github-org: ''
542           github_pr_whitelist:
543             - ''
544           github_pr_admin_list:
545             - ''
546
547 ################
548 # Packer Merge #
549 ################
550
551 - lf_packer_merge: &lf_packer_merge
552     name: lf-packer-merge
553
554     ######################
555     # Default parameters #
556     ######################
557
558     gerrit_merge_triggers:
559       - change-merged-event
560       - comment-added-contains-event:
561           comment-contains-value: remerge$
562
563     #####################
564     # Job Configuration #
565     #####################
566
567     builders:
568       - lf-infra-packer-validate:
569           packer-cloud-settings: '{packer-cloud-settings}'
570           packer-version: '{packer-version}'
571       - lf-infra-packer-build:
572           packer-cloud-settings: '{packer-cloud-settings}'
573           packer-version: '{packer-version}'
574           platform: '{platforms}'
575           template: '{templates}'
576
577 - job-template:
578     name: '{project-name}-packer-merge-{platforms}-{templates}'
579     id: gerrit-packer-merge
580     <<: *lf_packer_common
581     # yamllint disable-line rule:key-duplicates
582     <<: *lf_packer_merge
583
584     git-url: '$GIT_URL/$GERRIT_PROJECT'
585
586     scm:
587       - lf-infra-gerrit-scm:
588           git-url: '{git-url}'
589           refspec: '$GERRIT_REFSPEC'
590           branch: '$GERRIT_BRANCH'
591           submodule-recursive: '{submodule-recursive}'
592           choosing-strategy: gerrit
593           jenkins-ssh-credential: '{jenkins-ssh-credential}'
594
595     triggers:
596       - timed: '00 10 1 * *'
597       - gerrit:
598           server-name: '{gerrit-server-name}'
599           trigger-on: '{obj:gerrit_merge_triggers}'
600           projects:
601             - project-compare-type: ANT
602               project-pattern: '{project}'
603               branches:
604                 - branch-compare-type: ANT
605                   branch-pattern: '**/{branch}'
606               <<: *lf_packer_file_paths
607
608 - job-template:
609     name: '{project-name}-packer-merge-{platforms}-{templates}'
610     id: github-packer-merge
611     <<: *lf_packer_common
612     # yamllint disable-line rule:key-duplicates
613     <<: *lf_packer_merge
614
615     properties:
616       - github:
617           url: '{git-url}/{github-org}/{project}'
618
619     scm:
620       - lf-infra-github-scm:
621           url: '{git-clone-url}{github-org}/{project}'
622           refspec: ''
623           branch: 'refs/heads/{branch}'
624           submodule-recursive: '{submodule-recursive}'
625           choosing-strategy: default
626           jenkins-ssh-credential: '{jenkins-ssh-credential}'
627
628     triggers:
629       - timed: '00 10 1 * *'
630       - github
631       - pollscm:
632           cron: ''
633       - lf-infra-github-pr-trigger:
634           trigger-phrase: '^remerge$'
635           only-trigger-phrase: true
636           status-context: 'Packer {platforms}-${templates} Merge'
637           permit-all: false
638           github-hooks: true
639           github-org: '{github-org}'
640           github_pr_whitelist: '{obj:github_pr_whitelist}'
641           github_pr_admin_list: '{obj:github_pr_admin_list}'
642
643 #################
644 # Packer Verify #
645 #################
646
647 - lf_packer_verify: &lf_packer_verify
648     name: lf-packer-verify
649
650     ######################
651     # Default parameters #
652     ######################
653
654     build-timeout: 10
655
656     gerrit_verify_triggers:
657       - patchset-created-event:
658           exclude-drafts: true
659           exclude-trivial-rebase: false
660           exclude-no-code-change: false
661       - draft-published-event
662       - comment-added-contains-event:
663           comment-contains-value: recheck$
664
665     gerrit_trigger_file_paths:
666       - compare-type: ANT
667         pattern: 'packer/vars/**.json'
668       - compare-type: ANT
669         pattern: 'packer/templates/**.json'
670       - compare-type: ANT
671         pattern: 'packer/provision/**.sh'
672       - compare-type: ANT
673         pattern: 'packer/provision/lib/**'
674
675     #####################
676     # Job Configuration #
677     #####################
678
679     concurrent: true
680
681     builders:
682       - lf-infra-packer-validate:
683           packer-cloud-settings: '{packer-cloud-settings}'
684           packer-version: '{packer-version}'
685
686 - job-template:
687     name: '{project-name}-packer-verify'
688     id: gerrit-packer-verify
689     <<: *lf_packer_common
690     # yamllint disable-line rule:key-duplicates
691     <<: *lf_packer_verify
692
693     git-url: '$GIT_URL/$GERRIT_PROJECT'
694
695     scm:
696       - lf-infra-gerrit-scm:
697           git-url: '{git-url}'
698           refspec: '$GERRIT_REFSPEC'
699           branch: '$GERRIT_BRANCH'
700           submodule-recursive: '{submodule-recursive}'
701           choosing-strategy: gerrit
702           jenkins-ssh-credential: '{jenkins-ssh-credential}'
703
704     triggers:
705       - gerrit:
706           server-name: '{gerrit-server-name}'
707           trigger-on: '{obj:gerrit_verify_triggers}'
708           projects:
709             - project-compare-type: ANT
710               project-pattern: '{project}'
711               branches:
712                 - branch-compare-type: ANT
713                   branch-pattern: '**/{branch}'
714               file-paths: '{obj:gerrit_trigger_file_paths}'
715
716 - job-template:
717     name: '{project-name}-packer-verify'
718     id: github-packer-verify
719     <<: *lf_packer_common
720     # yamllint disable-line rule:key-duplicates
721     <<: *lf_packer_verify
722
723     properties:
724       - github:
725           url: '{git-url}/{github-org}/{project}'
726
727     scm:
728       - lf-infra-github-scm:
729           url: '{git-clone-url}{github-org}/{project}'
730           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
731           branch: '$sha1'
732           submodule-recursive: '{submodule-recursive}'
733           choosing-strategy: default
734           jenkins-ssh-credential: '{jenkins-ssh-credential}'
735
736     triggers:
737       - lf-infra-github-pr-trigger:
738           trigger-phrase: '^recheck$'
739           only-trigger-phrase: false
740           status-context: 'Packer Verify'
741           permit-all: true
742           github-hooks: true
743           github-org: ''
744           github_pr_whitelist:
745             - ''
746           github_pr_admin_list:
747             - ''