Merge "Pass common maven options to deploy file builder"
[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
115     wrappers:
116       - lf-infra-wrappers:
117           build-timeout: '{build-timeout}'
118           jenkins-ssh-credential: '{jenkins-ssh-credential}'
119
120     parameters:
121       - lf-infra-parameters:
122           project: '{project}'
123           stream: '{stream}'
124           branch: '{branch}'
125       - lf-infra-packer-parameters:
126           packer-version: '{packer-version}'
127
128 - lf_packer_merge_builders: &lf_packer_merge_builders
129     name: lf-packer-merge-builders
130     # Adds builders section common to merge packer jobs.
131     builders:
132       - lf-infra-packer-validate:
133           packer-version: '{packer-version}'
134       - lf-infra-packer-build:
135           platform: '{platforms}'
136           template: '{templates}'
137           packer-version: '{packer-version}'
138
139 - lf_packer_verify_builders: &lf_packer_verify_builders
140     # Adds builders section common to verify packer jobs.
141     name: lf-packer-verify-builders
142     builders:
143       - lf-infra-packer-validate:
144           packer-version: '{packer-version}'
145
146 - parameter:
147     name: lf-infra-jjb-parameters
148     parameters:
149       - string:
150           name: JJB_VERSION
151           default: '{jjb-version}'
152           description: Jenkins Job Builder version to download and install.
153
154 - parameter:
155     name: lf-infra-packer-parameters
156     parameters:
157       - string:
158           name: PACKER_VERSION
159           default: '{packer-version}'
160           description: Packer version to download and install.
161
162
163 #################
164 # Job Templates #
165 #################
166
167 # JJB verify and merge jobs are the same except for their scm, trigger, and
168 # builders definition. This anchor is the common template
169 - lf_jjb_verify_merge: &lf_jjb_verify_merge
170     name: lf-jjb-verify-merge
171     project-type: freestyle
172
173     node: '{build-node}'
174
175     ######################
176     # Default parameters #
177     ######################
178
179     stream: master
180     branch: master
181     submodule-recursive: true
182
183     #####################
184     # Job Configuration #
185     #####################
186
187     properties:
188       - lf-infra-properties:
189           project: '{project}'
190           build-days-to-keep: 7
191
192     parameters:
193       - lf-infra-parameters:
194           project: '{project}'
195           stream: '{stream}'
196           branch: '{branch}'
197       - lf-infra-jjb-parameters:
198           jjb-version: '{jjb-version}'
199
200     wrappers:
201       - lf-infra-wrappers:
202           build-timeout: 10
203           jenkins-ssh-credential: '{jenkins-ssh-credential}'
204
205     publishers:
206       - lf-infra-publish
207
208 - job-template:
209     name: '{project-name}-jjb-merge'
210     id: gerrit-jjb-merge
211     <<: *lf_jjb_verify_merge
212     # yamllint disable-line rule:key-duplicates
213     <<: *lf_jjb_merge_builders
214
215     ######################
216     # Default parameters #
217     ######################
218
219     git-url: '$GIT_URL/$GERRIT_PROJECT'
220
221     #####################
222     # Job Configuration #
223     #####################
224
225     scm:
226       - lf-infra-gerrit-scm:
227           git-url: '{git-url}'
228           refspec: ''
229           branch: '{branch}'
230           submodule-recursive: '{submodule-recursive}'
231           choosing-strategy: default
232           jenkins-ssh-credential: '{jenkins-ssh-credential}'
233
234     triggers:
235       - gerrit:
236           server-name: '{gerrit-server-name}'
237           trigger-on:
238             - change-merged-event
239             - comment-added-contains-event:
240                 comment-contains-value: remerge$
241           projects:
242             - project-compare-type: ANT
243               project-pattern: '{project}'
244               branches:
245                 - branch-compare-type: ANT
246                   branch-pattern: '**/{branch}'
247               <<: *lf_jjb_file_paths
248
249 - job-template:
250     name: '{project-name}-jjb-verify'
251     id: gerrit-jjb-verify
252     concurrent: true
253     <<: *lf_jjb_verify_merge
254     # yamllint disable-line rule:key-duplicates
255     <<: *lf_jjb_verify_builders
256
257     ######################
258     # Default parameters #
259     ######################
260
261     git-url: '$GIT_URL/$GERRIT_PROJECT'
262
263     #####################
264     # Job Configuration #
265     #####################
266
267     scm:
268       - lf-infra-gerrit-scm:
269           git-url: '{git-url}'
270           refspec: '$GERRIT_REFSPEC'
271           branch: '$GERRIT_BRANCH'
272           submodule-recursive: '{submodule-recursive}'
273           choosing-strategy: gerrit
274           jenkins-ssh-credential: '{jenkins-ssh-credential}'
275
276     triggers:
277       - gerrit:
278           server-name: '{gerrit-server-name}'
279           trigger-on:
280             - patchset-created-event:
281                 exclude-drafts: false
282                 exclude-trivial-rebase: false
283                 exclude-no-code-change: false
284             - draft-published-event
285             - comment-added-contains-event:
286                 comment-contains-value: recheck$
287           projects:
288             - project-compare-type: ANT
289               project-pattern: '{project}'
290               branches:
291                 - branch-compare-type: ANT
292                   branch-pattern: '**/{branch}'
293               <<: *lf_jjb_file_paths
294
295 - job-template:
296     name: '{project-name}-jjb-merge'
297     id: github-jjb-merge
298     <<: *lf_jjb_verify_merge
299     # yamllint disable-line rule:key-duplicates
300     <<: *lf_jjb_merge_builders
301
302     #####################
303     # Job Configuration #
304     #####################
305
306     properties:
307       - github:
308           url: '{git-url}/{github-org}/{project}'
309
310     scm:
311       - lf-infra-github-scm:
312           url: '{git-clone-url}{github-org}/{project}'
313           refspec: ''
314           branch: '{branch}'
315           submodule-recursive: '{submodule-recursive}'
316           choosing-strategy: default
317           jenkins-ssh-credential: '{jenkins-ssh-credential}'
318
319     triggers:
320       - github
321       - pollscm:
322           cron: ''
323       - lf-infra-github-pr-trigger:
324           trigger-phrase: '^remerge$'
325           only-trigger-phrase: true
326           status-context: 'JJB Merge'
327           permit-all: false
328           github-hooks: true
329           github-org: '{github-org}'
330           github_pr_whitelist: '{obj:github_pr_whitelist}'
331           github_pr_admin_list: '{obj:github_pr_admin_list}'
332
333 - job-template:
334     name: '{project-name}-jjb-verify'
335     id: github-jjb-verify
336     concurrent: true
337     <<: *lf_jjb_verify_merge
338     # yamllint disable-line rule:key-duplicates
339     <<: *lf_jjb_verify_builders
340
341     #####################
342     # Job Configuration #
343     #####################
344
345     properties:
346       - github:
347           url: '{git-url}/{github-org}/{project}'
348
349     scm:
350       - lf-infra-github-scm:
351           url: '{git-clone-url}{github-org}/{project}'
352           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
353           branch: '{branch}'
354           submodule-recursive: '{submodule-recursive}'
355           choosing-strategy: default
356           jenkins-ssh-credential: '{jenkins-ssh-credential}'
357
358     triggers:
359       - lf-infra-github-pr-trigger:
360           trigger-phrase: '^recheck$'
361           only-trigger-phrase: false
362           status-context: 'JJB Verify'
363           permit-all: true
364           github-hooks: true
365           github-org: ''
366           github_pr_whitelist:
367             - ''
368           github_pr_admin_list:
369             - ''
370
371 - job-template:
372     name: '{project-name}-packer-merge-{platforms}-{templates}'
373     id: gerrit-packer-merge
374     concurrent: true
375     <<: *lf_jjb_verify_merge
376     # yamllint disable-line rule:key-duplicates
377     <<: *lf_packer_common
378     # yamllint disable-line rule:key-duplicates
379     <<: *lf_packer_merge_builders
380
381     ######################
382     # Default parameters #
383     ######################
384
385     git-url: '$GIT_URL/$GERRIT_PROJECT'
386
387     #####################
388     # Job Configuration #
389     #####################
390
391     scm:
392       - lf-infra-gerrit-scm:
393           git-url: '{git-url}'
394           refspec: '$GERRIT_REFSPEC'
395           branch: '$GERRIT_BRANCH'
396           submodule-recursive: '{submodule-recursive}'
397           choosing-strategy: gerrit
398           jenkins-ssh-credential: '{jenkins-ssh-credential}'
399
400     triggers:
401       - gerrit:
402           server-name: '{gerrit-server-name}'
403           trigger-on:
404             - change-merged-event
405             - comment-added-contains-event:
406                 comment-contains-value: remerge$
407           projects:
408             - project-compare-type: ANT
409               project-pattern: '{project}'
410               branches:
411                 - branch-compare-type: ANT
412                   branch-pattern: '**/{branch}'
413               <<: *lf_packer_file_paths
414
415 - job-template:
416     name: '{project-name}-packer-verify'
417     id: gerrit-packer-verify
418     concurrent: true
419     <<: *lf_jjb_verify_merge
420     # yamllint disable-line rule:key-duplicates
421     <<: *lf_packer_common
422     # yamllint disable-line rule:key-duplicates
423     <<: *lf_packer_verify_builders
424
425     ######################
426     # Default parameters #
427     ######################
428
429     build-timeout: 10
430     git-url: '$GIT_URL/$GERRIT_PROJECT'
431
432     #####################
433     # Job Configuration #
434     #####################
435
436     scm:
437       - lf-infra-gerrit-scm:
438           git-url: '{git-url}'
439           refspec: '$GERRIT_REFSPEC'
440           branch: '$GERRIT_BRANCH'
441           submodule-recursive: '{submodule-recursive}'
442           choosing-strategy: gerrit
443           jenkins-ssh-credential: '{jenkins-ssh-credential}'
444
445     triggers:
446       - gerrit:
447           server-name: '{gerrit-server-name}'
448           trigger-on:
449             - patchset-created-event:
450                 exclude-drafts: false
451                 exclude-trivial-rebase: false
452                 exclude-no-code-change: false
453             - draft-published-event
454             - comment-added-contains-event:
455                 comment-contains-value: recheck$
456           projects:
457             - project-compare-type: ANT
458               project-pattern: '{project}'
459               branches:
460                 - branch-compare-type: ANT
461                   branch-pattern: '**/{branch}'
462               <<: *lf_packer_file_paths
463
464
465 - job-template:
466     name: '{project-name}-packer-merge-{platforms}-{templates}'
467     id: github-packer-merge
468     concurrent: true
469     <<: *lf_jjb_verify_merge
470     # yamllint disable-line rule:key-duplicates
471     <<: *lf_packer_common
472     # yamllint disable-line rule:key-duplicates
473     <<: *lf_packer_merge_builders
474
475     #####################
476     # Job Configuration #
477     #####################
478
479     properties:
480       - github:
481           url: '{git-url}/{github-org}/{project}'
482
483     scm:
484       - lf-infra-github-scm:
485           url: '{git-clone-url}{github-org}/{project}'
486           refspec: ''
487           branch: '{branch}'
488           submodule-recursive: '{submodule-recursive}'
489           choosing-strategy: default
490           jenkins-ssh-credential: '{jenkins-ssh-credential}'
491
492     triggers:
493       - github
494       - pollscm:
495           cron: ''
496       - lf-infra-github-pr-trigger:
497           trigger-phrase: '^remerge$'
498           only-trigger-phrase: true
499           status-context: 'Packer {platforms}-${templates} Merge'
500           permit-all: false
501           github-hooks: true
502           github-org: '{github-org}'
503           github_pr_whitelist: '{obj:github_pr_whitelist}'
504           github_pr_admin_list: '{obj:github_pr_admin_list}'
505
506 - job-template:
507     name: '{project-name}-packer-verify'
508     id: github-packer-verify
509     concurrent: true
510     <<: *lf_jjb_verify_merge
511     # yamllint disable-line rule:key-duplicates
512     <<: *lf_packer_common
513     # yamllint disable-line rule:key-duplicates
514     <<: *lf_packer_verify_builders
515
516     ######################
517     # Default parameters #
518     ######################
519
520     build-timeout: 10
521
522     #####################
523     # Job Configuration #
524     #####################
525
526     properties:
527       - github:
528           url: '{git-url}/{github-org}/{project}'
529
530     scm:
531       - lf-infra-github-scm:
532           url: '{git-clone-url}{github-org}/{project}'
533           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
534           branch: '{branch}'
535           submodule-recursive: '{submodule-recursive}'
536           choosing-strategy: default
537           jenkins-ssh-credential: '{jenkins-ssh-credential}'
538
539     triggers:
540       - lf-infra-github-pr-trigger:
541           trigger-phrase: '^recheck$'
542           only-trigger-phrase: false
543           status-context: 'Packer Verify'
544           permit-all: true
545           github-hooks: true
546           github-org: ''
547           github_pr_whitelist:
548             - ''
549           github_pr_admin_list:
550             - ''