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