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