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