40e718506777c87116aba02de418e29a242b43d6
[releng/global-jjb.git] / jjb / lf-ci-jobs.yaml
1 ---
2 - job-group:
3     name: '{project-name}-ci-jobs'
4
5     # This job group contains all the recommended jobs that should be deployed
6     # for any project ci.
7
8     jjb-version: 1.6.2
9
10     jobs:
11       - gerrit-jjb-merge
12       - gerrit-jjb-verify
13
14 - job-group:
15     name: '{project-name}-github-ci-jobs'
16
17     # This job group contains all the recommended jobs that should be deployed
18     # for any project ci that is using github.
19
20     jjb-version: 1.6.2
21
22     jobs:
23       - github-jjb-merge
24       - github-jjb-verify
25
26
27 - job-group:
28     name: '{project-name}-packer-jobs'
29
30     # This job group contains all the recommended jobs that should be deployed
31     # for any project ci that is using packer.
32
33     packer-version: 1.0.2
34
35     jobs:
36       - gerrit-packer-merge
37       - gerrit-packer-verify
38
39
40 - job-group:
41     name: '{project-name}-github-packer-jobs'
42
43     # This job group contains all the recommended jobs that should be deployed
44     # for any project ci that is using packer.
45
46     packer-version: 1.0.2
47
48     jobs:
49       - github-packer-merge
50       - github-packer-verify
51
52
53 ####################
54 # Anchors & Macros #
55 ####################
56
57 - builder:
58     name: lf-infra-jjbini
59     builders:
60       - config-file-provider:
61           files:
62             - file-id: jjbini
63               target: '$HOME/.config/jenkins_jobs/jenkins_jobs.ini'
64
65 - lf_jjb_file_paths: &lf_jjb_file_paths
66     name: lf-jjb-file-paths
67     file-paths:
68       - compare-type: ANT
69         pattern: '**/*.sh'
70       - compare-type: ANT
71         pattern: '**/*.yaml'
72
73 - lf_packer_file_paths: &lf_packer_file_paths
74     name: lf-packer-file-paths
75     file-paths:
76       # Common files for all projects
77       - compare-type: ANT
78         pattern: 'packer/vars/{platforms}.json'
79       - compare-type: ANT
80         pattern: 'packer/templates/{templates}.json'
81       - compare-type: ANT
82         pattern: 'packer/provision/{templates}.sh'
83       - compare-type: ANT
84         pattern: 'packer/provision/lib/**'
85
86 - lf_jjb_merge_builders: &lf_jjb_merge_builders
87     name: lf-jjb-merge-builders
88     builders:
89       - lf-infra-jjbini
90       - shell: !include-raw-escape:
91           - ../shell/jjb-install.sh
92           - ../shell/jjb-merge-job.sh
93
94 - lf_jjb_verify_builders: &lf_jjb_verify_builders
95     name: lf-jjb-verfy-builders
96     builders:
97       - lf-infra-jjbini
98       - shell: !include-raw-escape:
99           - ../shell/git-validate-jira-urls.sh
100           - ../shell/jjb-install.sh
101           - ../shell/jjb-verify-job.sh
102           - ../shell/jjb-check-unicode.sh
103       - lf-infra-gpg-verify-git-signature
104
105 - lf_packer: &lf_packer_common
106     name: lf-packer-common
107     # Adds wrappers and parameters sections common to packer jobs.
108
109     ######################
110     # Default parameters #
111     ######################
112
113     build-timeout: 45
114     packer-cloud-settings: packer-cloud-env
115
116     wrappers:
117       - lf-infra-wrappers:
118           build-timeout: '{build-timeout}'
119           jenkins-ssh-credential: '{jenkins-ssh-credential}'
120
121     parameters:
122       - lf-infra-parameters:
123           project: '{project}'
124           stream: '{stream}'
125           branch: '{branch}'
126       - lf-infra-packer-parameters:
127           packer-version: '{packer-version}'
128
129 - lf_packer_merge_builders: &lf_packer_merge_builders
130     name: lf-packer-merge-builders
131     # Adds builders section common to merge packer jobs.
132     # {packer-cloud-settings} is passed from the project, defines the managed
133     #                   file-id name created in Jenkins
134     #                   (default: packer-cloud-env)
135     # {packer-version}: is global defined in job group level, the version number
136     #                   can be updated to install the latest version of packer.
137     # {platforms}:      defines the packer platform file, passed from the project.
138     # {template}:       defines the packer template file, passed from the project.
139     builders:
140       - lf-infra-packer-validate:
141           packer-cloud-settings: '{packer-cloud-settings}'
142           packer-version: '{packer-version}'
143       - lf-infra-packer-build:
144           packer-cloud-settings: '{packer-cloud-settings}'
145           packer-version: '{packer-version}'
146           platform: '{platforms}'
147           template: '{templates}'
148
149 - lf_packer_verify_builders: &lf_packer_verify_builders
150     # Adds builders section common to verify packer jobs.
151     # {packer-cloud-settings} is passed from the project, defines the managed
152     #                   file-id name created in Jenkins
153     #                   (default: packer-cloud-env)
154     # {packer-version}: is global defined in job group level, the version number
155     #                   can be updated to install the latest version of packer.
156     name: lf-packer-verify-builders
157     builders:
158       - lf-infra-packer-validate:
159           packer-cloud-settings: '{packer-cloud-settings}'
160           packer-version: '{packer-version}'
161
162 - parameter:
163     name: lf-infra-jjb-parameters
164     parameters:
165       - string:
166           name: JJB_VERSION
167           default: '{jjb-version}'
168           description: Jenkins Job Builder version to download and install.
169
170 - parameter:
171     name: lf-infra-packer-parameters
172     parameters:
173       - string:
174           name: PACKER_VERSION
175           default: '{packer-version}'
176           description: Packer version to download and install.
177
178
179 #################
180 # Job Templates #
181 #################
182
183 # JJB verify and merge jobs are the same except for their scm, trigger, and
184 # builders definition. This anchor is the common template
185 - lf_jjb_verify_merge: &lf_jjb_verify_merge
186     name: lf-jjb-verify-merge
187     project-type: freestyle
188
189     node: '{build-node}'
190
191     ######################
192     # Default parameters #
193     ######################
194
195     stream: master
196     branch: master
197     submodule-recursive: true
198
199     #####################
200     # Job Configuration #
201     #####################
202
203     properties:
204       - lf-infra-properties:
205           project: '{project}'
206           build-days-to-keep: 7
207
208     parameters:
209       - lf-infra-parameters:
210           project: '{project}'
211           stream: '{stream}'
212           branch: '{branch}'
213       - lf-infra-jjb-parameters:
214           jjb-version: '{jjb-version}'
215
216     wrappers:
217       - lf-infra-wrappers:
218           build-timeout: 10
219           jenkins-ssh-credential: '{jenkins-ssh-credential}'
220
221     publishers:
222       - lf-infra-publish
223
224 - job-template:
225     name: '{project-name}-jjb-merge'
226     id: gerrit-jjb-merge
227     <<: *lf_jjb_verify_merge
228     # yamllint disable-line rule:key-duplicates
229     <<: *lf_jjb_merge_builders
230
231     ######################
232     # Default parameters #
233     ######################
234
235     git-url: '$GIT_URL/$GERRIT_PROJECT'
236
237     #####################
238     # Job Configuration #
239     #####################
240
241     scm:
242       - lf-infra-gerrit-scm:
243           git-url: '{git-url}'
244           refspec: ''
245           branch: '{branch}'
246           submodule-recursive: '{submodule-recursive}'
247           choosing-strategy: default
248           jenkins-ssh-credential: '{jenkins-ssh-credential}'
249
250     triggers:
251       - gerrit:
252           server-name: '{gerrit-server-name}'
253           trigger-on:
254             - change-merged-event
255             - comment-added-contains-event:
256                 comment-contains-value: remerge$
257           projects:
258             - project-compare-type: ANT
259               project-pattern: '{project}'
260               branches:
261                 - branch-compare-type: ANT
262                   branch-pattern: '**/{branch}'
263               <<: *lf_jjb_file_paths
264
265 - job-template:
266     name: '{project-name}-jjb-verify'
267     id: gerrit-jjb-verify
268     concurrent: true
269     <<: *lf_jjb_verify_merge
270     # yamllint disable-line rule:key-duplicates
271     <<: *lf_jjb_verify_builders
272
273     ######################
274     # Default parameters #
275     ######################
276
277     git-url: '$GIT_URL/$GERRIT_PROJECT'
278
279     #####################
280     # Job Configuration #
281     #####################
282
283     scm:
284       - lf-infra-gerrit-scm:
285           git-url: '{git-url}'
286           refspec: '$GERRIT_REFSPEC'
287           branch: '$GERRIT_BRANCH'
288           submodule-recursive: '{submodule-recursive}'
289           choosing-strategy: gerrit
290           jenkins-ssh-credential: '{jenkins-ssh-credential}'
291
292     triggers:
293       - gerrit:
294           server-name: '{gerrit-server-name}'
295           trigger-on:
296             - patchset-created-event:
297                 exclude-drafts: false
298                 exclude-trivial-rebase: false
299                 exclude-no-code-change: false
300             - draft-published-event
301             - comment-added-contains-event:
302                 comment-contains-value: recheck$
303           projects:
304             - project-compare-type: ANT
305               project-pattern: '{project}'
306               branches:
307                 - branch-compare-type: ANT
308                   branch-pattern: '**/{branch}'
309               <<: *lf_jjb_file_paths
310
311 - job-template:
312     name: '{project-name}-jjb-merge'
313     id: github-jjb-merge
314     <<: *lf_jjb_verify_merge
315     # yamllint disable-line rule:key-duplicates
316     <<: *lf_jjb_merge_builders
317
318     #####################
319     # Job Configuration #
320     #####################
321
322     properties:
323       - github:
324           url: '{git-url}/{github-org}/{project}'
325
326     scm:
327       - lf-infra-github-scm:
328           url: '{git-clone-url}{github-org}/{project}'
329           refspec: ''
330           branch: '{branch}'
331           submodule-recursive: '{submodule-recursive}'
332           choosing-strategy: default
333           jenkins-ssh-credential: '{jenkins-ssh-credential}'
334
335     triggers:
336       - github
337       - pollscm:
338           cron: ''
339       - lf-infra-github-pr-trigger:
340           trigger-phrase: '^remerge$'
341           only-trigger-phrase: true
342           status-context: 'JJB Merge'
343           permit-all: false
344           github-hooks: true
345           github-org: '{github-org}'
346           github_pr_whitelist: '{obj:github_pr_whitelist}'
347           github_pr_admin_list: '{obj:github_pr_admin_list}'
348
349 - job-template:
350     name: '{project-name}-jjb-verify'
351     id: github-jjb-verify
352     concurrent: true
353     <<: *lf_jjb_verify_merge
354     # yamllint disable-line rule:key-duplicates
355     <<: *lf_jjb_verify_builders
356
357     #####################
358     # Job Configuration #
359     #####################
360
361     properties:
362       - github:
363           url: '{git-url}/{github-org}/{project}'
364
365     scm:
366       - lf-infra-github-scm:
367           url: '{git-clone-url}{github-org}/{project}'
368           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
369           branch: '{branch}'
370           submodule-recursive: '{submodule-recursive}'
371           choosing-strategy: default
372           jenkins-ssh-credential: '{jenkins-ssh-credential}'
373
374     triggers:
375       - lf-infra-github-pr-trigger:
376           trigger-phrase: '^recheck$'
377           only-trigger-phrase: false
378           status-context: 'JJB Verify'
379           permit-all: true
380           github-hooks: true
381           github-org: ''
382           github_pr_whitelist:
383             - ''
384           github_pr_admin_list:
385             - ''
386
387 - job-template:
388     name: '{project-name}-packer-merge-{platforms}-{templates}'
389     id: gerrit-packer-merge
390     concurrent: true
391     <<: *lf_jjb_verify_merge
392     # yamllint disable-line rule:key-duplicates
393     <<: *lf_packer_common
394     # yamllint disable-line rule:key-duplicates
395     <<: *lf_packer_merge_builders
396
397     ######################
398     # Default parameters #
399     ######################
400
401     git-url: '$GIT_URL/$GERRIT_PROJECT'
402
403     #####################
404     # Job Configuration #
405     #####################
406
407     scm:
408       - lf-infra-gerrit-scm:
409           git-url: '{git-url}'
410           refspec: '$GERRIT_REFSPEC'
411           branch: '$GERRIT_BRANCH'
412           submodule-recursive: '{submodule-recursive}'
413           choosing-strategy: gerrit
414           jenkins-ssh-credential: '{jenkins-ssh-credential}'
415
416     triggers:
417       - timed: '00 10 1 * *'
418       - gerrit:
419           server-name: '{gerrit-server-name}'
420           trigger-on:
421             - change-merged-event
422             - comment-added-contains-event:
423                 comment-contains-value: remerge$
424           projects:
425             - project-compare-type: ANT
426               project-pattern: '{project}'
427               branches:
428                 - branch-compare-type: ANT
429                   branch-pattern: '**/{branch}'
430               <<: *lf_packer_file_paths
431
432 - job-template:
433     name: '{project-name}-packer-verify'
434     id: gerrit-packer-verify
435     concurrent: true
436     <<: *lf_jjb_verify_merge
437     # yamllint disable-line rule:key-duplicates
438     <<: *lf_packer_common
439     # yamllint disable-line rule:key-duplicates
440     <<: *lf_packer_verify_builders
441
442     ######################
443     # Default parameters #
444     ######################
445
446     build-timeout: 10
447     git-url: '$GIT_URL/$GERRIT_PROJECT'
448
449     #####################
450     # Job Configuration #
451     #####################
452
453     scm:
454       - lf-infra-gerrit-scm:
455           git-url: '{git-url}'
456           refspec: '$GERRIT_REFSPEC'
457           branch: '$GERRIT_BRANCH'
458           submodule-recursive: '{submodule-recursive}'
459           choosing-strategy: gerrit
460           jenkins-ssh-credential: '{jenkins-ssh-credential}'
461
462     triggers:
463       - gerrit:
464           server-name: '{gerrit-server-name}'
465           trigger-on:
466             - patchset-created-event:
467                 exclude-drafts: false
468                 exclude-trivial-rebase: false
469                 exclude-no-code-change: false
470             - draft-published-event
471             - comment-added-contains-event:
472                 comment-contains-value: recheck$
473           projects:
474             - project-compare-type: ANT
475               project-pattern: '{project}'
476               branches:
477                 - branch-compare-type: ANT
478                   branch-pattern: '**/{branch}'
479               <<: *lf_packer_file_paths
480
481
482 - job-template:
483     name: '{project-name}-packer-merge-{platforms}-{templates}'
484     id: github-packer-merge
485     concurrent: true
486     <<: *lf_jjb_verify_merge
487     # yamllint disable-line rule:key-duplicates
488     <<: *lf_packer_common
489     # yamllint disable-line rule:key-duplicates
490     <<: *lf_packer_merge_builders
491
492     #####################
493     # Job Configuration #
494     #####################
495
496     properties:
497       - github:
498           url: '{git-url}/{github-org}/{project}'
499
500     scm:
501       - lf-infra-github-scm:
502           url: '{git-clone-url}{github-org}/{project}'
503           refspec: ''
504           branch: '{branch}'
505           submodule-recursive: '{submodule-recursive}'
506           choosing-strategy: default
507           jenkins-ssh-credential: '{jenkins-ssh-credential}'
508
509     triggers:
510       - timed: '00 10 1 * *'
511       - github
512       - pollscm:
513           cron: ''
514       - lf-infra-github-pr-trigger:
515           trigger-phrase: '^remerge$'
516           only-trigger-phrase: true
517           status-context: 'Packer {platforms}-${templates} Merge'
518           permit-all: false
519           github-hooks: true
520           github-org: '{github-org}'
521           github_pr_whitelist: '{obj:github_pr_whitelist}'
522           github_pr_admin_list: '{obj:github_pr_admin_list}'
523
524 - job-template:
525     name: '{project-name}-packer-verify'
526     id: github-packer-verify
527     concurrent: true
528     <<: *lf_jjb_verify_merge
529     # yamllint disable-line rule:key-duplicates
530     <<: *lf_packer_common
531     # yamllint disable-line rule:key-duplicates
532     <<: *lf_packer_verify_builders
533
534     ######################
535     # Default parameters #
536     ######################
537
538     build-timeout: 10
539
540     #####################
541     # Job Configuration #
542     #####################
543
544     properties:
545       - github:
546           url: '{git-url}/{github-org}/{project}'
547
548     scm:
549       - lf-infra-github-scm:
550           url: '{git-clone-url}{github-org}/{project}'
551           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
552           branch: '{branch}'
553           submodule-recursive: '{submodule-recursive}'
554           choosing-strategy: default
555           jenkins-ssh-credential: '{jenkins-ssh-credential}'
556
557     triggers:
558       - lf-infra-github-pr-trigger:
559           trigger-phrase: '^recheck$'
560           only-trigger-phrase: false
561           status-context: 'Packer Verify'
562           permit-all: true
563           github-hooks: true
564           github-org: ''
565           github_pr_whitelist:
566             - ''
567           github_pr_admin_list:
568             - ''