Make sure that jjb-cleanup.sh allows unbound vars
[releng/global-jjb.git] / jjb / lf-maven-jobs.yaml
1 ---
2 # This file contains job templates for Maven projects.
3
4 - job-group:
5     name: '{project-name}-maven-jobs'
6
7     # This job group contains all the recommended jobs that should be deployed
8     # for any project ci.
9
10     # TODO: Add Maven Merge job to this list once it's been fully tested.
11     jobs:
12       - gerrit-maven-clm
13       - gerrit-maven-merge
14       - gerrit-maven-stage
15       - gerrit-maven-verify
16       - gerrit-maven-verify-dependencies
17
18 - job-group:
19     name: '{project-name}-github-maven-jobs'
20
21     # This job group contains all the recommended jobs that should be deployed
22     # for any project ci that is using github.
23
24     # TODO: Add Maven Merge job to this list once it's been fully tested.
25     jobs:
26       - github-maven-clm
27       - github-maven-merge
28       - github-maven-stage
29       - github-maven-verify
30
31 - job-group:
32     name: '{project-name}-maven-javadoc-jobs'
33
34     # This job group contains all the recommended jobs that should be deployed
35     # for any project ci.
36
37     jobs:
38       - gerrit-maven-javadoc-publish
39       - gerrit-maven-javadoc-verify
40
41 - job-group:
42     name: '{project-name}-github-maven-javadoc-jobs'
43
44     # This job group contains all the recommended jobs that should be deployed
45     # for any project ci.
46
47     jobs:
48       - github-maven-javadoc-publish
49       - github-maven-javadoc-verify
50
51 ##########
52 # Macros #
53 ##########
54
55 - builder:
56     name: lf-maven-build
57     builders:
58       - inject:
59           properties-content: 'MAVEN_GOALS={mvn-goals}'
60       - shell: !include-raw-escape:
61           - ../shell/common-variables.sh
62           - ../shell/maven-build.sh
63
64 - builder:
65     name: lf-maven-deploy
66     builders:
67       - shell: !include-raw:
68           - ../shell/common-variables.sh
69           - ../shell/maven-deploy.sh
70
71 - builder:
72     name: lf-maven-stage
73     builders:
74       # include-raw-escape fails due to JJB bug
75       - shell: !include-raw:
76           - ../shell/common-variables.sh
77           - ../shell/maven-stage.sh
78
79 - builder:
80     name: lf-update-java-alternatives
81     builders:
82       - inject:
83           # Work around inject plugin overriding our GIT_URL variable incorrectly
84           # https://issues.jenkins-ci.org/browse/JENKINS-49775
85           properties-content: |
86             SET_JDK_VERSION={java-version}
87             GIT_URL="$GIT_URL"
88       - shell: !include-raw-escape: ../shell/update-java-alternatives.sh
89       - inject:
90           properties-file: '/tmp/java.env'
91
92 ####################
93 # COMMON FUNCTIONS #
94 ####################
95
96 - lf_maven_common: &lf_maven_common
97     name: lf-maven-common
98
99     ######################
100     # Default parameters #
101     ######################
102
103     archive-artifacts: >
104       **/*.log
105       **/hs_err_*.log
106       **/target/**/feature.xml
107       **/target/failsafe-reports/failsafe-summary.xml
108       **/target/surefire-reports/*-output.txt
109
110     #####################
111     # Job Configuration #
112     #####################
113
114     project-type: freestyle
115     node: '{build-node}'
116
117     properties:
118       - lf-infra-properties:
119           build-days-to-keep: '{build-days-to-keep}'
120
121     parameters:
122       - lf-infra-parameters:
123           project: '{project}'
124           branch: '{branch}'
125           stream: '{stream}'
126           lftools-version: '{lftools-version}'
127       - lf-infra-maven-parameters:
128           mvn-opts: '{mvn-opts}'
129           mvn-params: '{mvn-params}'
130           mvn-version: '{mvn-version}'
131       - string:
132           name: ARCHIVE_ARTIFACTS
133           default: '{archive-artifacts}'
134           description: Artifacts to archive to the logs server.
135
136     wrappers:
137       - lf-infra-wrappers:
138           build-timeout: '{build-timeout}'
139           jenkins-ssh-credential: '{jenkins-ssh-credential}'
140
141     publishers:
142       # TODO: Make email notification work.
143       # - lf-infra-email-notify:
144       #     email-recipients: '{email-recipients}'
145       #     email-prefix: '[releng]'
146       - lf-infra-publish
147
148 #############
149 # Maven CLM #
150 #############
151
152 - lf_maven_clm: &lf_maven_clm
153     name: lf-maven-clm
154
155     ######################
156     # Default parameters #
157     ######################
158
159     branch: master
160     build-days-to-keep: 30  # 30 days for troubleshooting purposes
161     build-timeout: 60
162     disable-job: false
163     git-url: '$GIT_URL/$PROJECT'
164     github-url: 'https://github.com'
165     java-version: openjdk8
166     mvn-global-settings: global-settings
167     mvn-opts: ''
168     mvn-params: ''
169     mvn-version: mvn35
170     nexus-iq-stage: 'build'
171     stream: master
172     submodule-recursive: true
173
174     nexus_iq_scan_patterns:
175       - '**/*.ear'
176       - '**/*.jar'
177       - '**/*.tar.gz'
178       - '**/*.war'
179       - '**/*.zip'
180
181     gerrit_clm_triggers:
182       - comment-added-contains-event:
183           comment-contains-value: run-clm$
184
185     parameters:
186       - lf-infra-parameters:
187           project: '{project}'
188           branch: '{branch}'
189           stream: '{stream}'
190           lftools-version: '{lftools-version}'
191       - lf-infra-maven-parameters:
192           mvn-opts: '{mvn-opts}'
193           mvn-params: '{mvn-params}'
194           mvn-version: '{mvn-version}'
195       - string:
196           name: ARCHIVE_ARTIFACTS
197           default: '{archive-artifacts}'
198           description: Artifacts to archive to the logs server.
199       - lf-clm-parameters:
200           nexus-iq-stage: '{nexus-iq-stage}'
201
202     #####################
203     # Job Configuration #
204     #####################
205
206     disabled: '{disable-job}'
207
208     builders:
209       - lf-infra-pre-build
210       - lf-maven-install:
211           mvn-version: '{mvn-version}'
212       - lf-update-java-alternatives:
213           java-version: '{java-version}'
214       - lf-provide-maven-settings:
215           global-settings-file: '{mvn-global-settings}'
216           settings-file: '{mvn-settings}'
217       - shell: !include-raw-escape:
218           - ../shell/common-variables.sh
219           - ../shell/sonatype-clm.sh
220       - lf-provide-maven-settings-cleanup
221       - shell: 'find . -regex ".*karaf/target" | xargs rm -rf'
222       - nexus-iq-policy-evaluator:
223           stage: '{nexus-iq-stage}'
224           application-type: 'manual'
225           application-id: '{project-name}'
226           scan-patterns: '{obj:nexus_iq_scan_patterns}'
227           fail-build-network-error: true
228
229 - job-template:
230     name: '{project-name}-maven-clm-{stream}'
231     id: gerrit-maven-clm
232     <<: *lf_maven_common
233     # yamllint disable-line rule:key-duplicates
234     <<: *lf_maven_clm
235
236     scm:
237       - lf-infra-gerrit-scm:
238           jenkins-ssh-credential: '{jenkins-ssh-credential}'
239           git-url: '{git-url}'
240           refspec: '$GERRIT_REFSPEC'
241           branch: '$GERRIT_BRANCH'
242           submodule-recursive: '{submodule-recursive}'
243           choosing-strategy: default
244
245     triggers:
246       # Build weekly on Saturdays
247       - timed: 'H H * * 6'
248       - gerrit:
249           server-name: '{gerrit-server-name}'
250           trigger-on: '{obj:gerrit_clm_triggers}'
251           projects:
252             - project-compare-type: ANT
253               project-pattern: '{project}'
254               branches:
255                 - branch-compare-type: ANT
256                   branch-pattern: '**/{branch}'
257           skip-vote:
258             successful: true
259             failed: true
260             unstable: true
261             notbuilt: true
262
263 - job-template:
264     name: '{project-name}-maven-clm-{stream}'
265     id: github-maven-clm
266     <<: *lf_maven_common
267     # yamllint disable-line rule:key-duplicates
268     <<: *lf_maven_clm
269
270     properties:
271       - lf-infra-properties:
272           build-days-to-keep: '{build-days-to-keep}'
273       - github:
274           url: '{github-url}/{github-org}/{project}'
275
276     scm:
277       - lf-infra-github-scm:
278           url: '{git-clone-url}{github-org}/{project}'
279           refspec: ''
280           branch: 'refs/heads/{branch}'
281           submodule-recursive: '{submodule-recursive}'
282           choosing-strategy: default
283           jenkins-ssh-credential: '{jenkins-ssh-credential}'
284
285     triggers:
286       # Build weekly on Saturdays
287       - timed: 'H H * * 6'
288       - github-pull-request:
289           trigger-phrase: '^run-clm$'
290           only-trigger-phrase: true
291           status-context: 'CLM'
292           permit-all: true
293           github-hooks: true
294           org-list:
295             - '{github-org}'
296           white-list: '{obj:github_pr_whitelist}'
297           admin-list: '{obj:github_pr_admin_list}'
298           white-list-target-branches:
299             - '{branch}'
300
301 #########################
302 # Maven Javadoc Publish #
303 #########################
304
305 - lf_maven_javadoc_publish: &lf_maven_javadoc_publish
306     name: lf-maven-javadoc-publish
307
308     ######################
309     # Default parameters #
310     ######################
311
312     branch: master
313     build-days-to-keep: 30  # 30 days in case a release takes long to get approved.
314     build-timeout: 60
315     disable-job: false
316     git-url: '$GIT_URL/$PROJECT'
317     github-url: 'https://github.com'
318     java-version: openjdk8
319     mvn-global-settings: global-settings
320     mvn-opts: ''
321     mvn-params: ''
322     mvn-version: mvn35
323     stream: master
324     submodule-recursive: true
325
326     gerrit_merge_triggers:
327       - change-merged-event
328       - comment-added-contains-event:
329           comment-contains-value: remerge$
330
331     #####################
332     # Job Configuration #
333     #####################
334
335     disabled: '{disable-job}'
336
337     builders:
338       - lf-infra-pre-build
339       - lf-maven-install:
340           mvn-version: '{mvn-version}'
341       - lf-update-java-alternatives:
342           java-version: '{java-version}'
343       - lf-provide-maven-settings:
344           global-settings-file: '{mvn-global-settings}'
345           settings-file: '{mvn-settings}'
346       - lf-infra-create-netrc:
347           server-id: '{mvn-site-id}'
348       - inject:
349           properties-content: 'DEPLOY_PATH={javadoc-path}'
350       - shell: !include-raw-escape:
351           - ../shell/common-variables.sh
352           - ../shell/maven-javadoc-generate.sh
353           - ../shell/maven-javadoc-publish.sh
354       - lf-provide-maven-settings-cleanup
355
356 - job-template:
357     name: '{project-name}-maven-javadoc-publish-{stream}'
358     id: gerrit-maven-javadoc-publish
359     <<: *lf_maven_common
360     # yamllint disable-line rule:key-duplicates
361     <<: *lf_maven_javadoc_publish
362
363     git-url: '$GIT_URL/$GERRIT_PROJECT'
364
365     scm:
366       - lf-infra-gerrit-scm:
367           git-url: '{git-url}'
368           refspec: ''
369           branch: '{branch}'
370           submodule-recursive: '{submodule-recursive}'
371           choosing-strategy: default
372           jenkins-ssh-credential: '{jenkins-ssh-credential}'
373
374     triggers:
375       - gerrit:
376           server-name: '{gerrit-server-name}'
377           trigger-on: '{obj:gerrit_merge_triggers}'
378           projects:
379             - project-compare-type: ANT
380               project-pattern: '{project}'
381               branches:
382                 - branch-compare-type: ANT
383                   branch-pattern: '**/{branch}'
384
385 - job-template:
386     name: '{project-name}-maven-javadoc-publish-{stream}'
387     id: github-maven-javadoc-publish
388     <<: *lf_maven_common
389     # yamllint disable-line rule:key-duplicates
390     <<: *lf_maven_javadoc_publish
391
392     properties:
393       - lf-infra-properties:
394           build-days-to-keep: '{build-days-to-keep}'
395       - github:
396           url: '{github-url}/{github-org}/{project}'
397
398     scm:
399       - lf-infra-github-scm:
400           url: '{git-clone-url}{github-org}/{project}'
401           refspec: ''
402           branch: '{branch}'
403           submodule-recursive: '{submodule-recursive}'
404           choosing-strategy: default
405           jenkins-ssh-credential: '{jenkins-ssh-credential}'
406
407     triggers:
408       - github
409       - pollscm:
410           cron: ''
411       - github-pull-request:
412           trigger-phrase: '^remerge$'
413           only-trigger-phrase: true
414           status-context: 'Maven Javadoc Publish'
415           permit-all: true
416           github-hooks: true
417           org-list:
418             - '{github-org}'
419           white-list: '{obj:github_pr_whitelist}'
420           admin-list: '{obj:github_pr_admin_list}'
421           white-list-target-branches:
422             - '{branch}'
423
424 ########################
425 # Maven Javadoc Verify #
426 ########################
427
428 - lf_maven_javadoc_verify: &lf_maven_javadoc_verify
429     name: lf-maven-javadoc-verify
430
431     ######################
432     # Default parameters #
433     ######################
434
435     branch: master
436     build-days-to-keep: 30  # 30 days in case a release takes long to get approved.
437     build-timeout: 60
438     disable-job: false
439     git-url: '$GIT_URL/$PROJECT'
440     github-url: 'https://github.com'
441     java-version: openjdk8
442     mvn-global-settings: global-settings
443     mvn-opts: ''
444     mvn-params: ''
445     mvn-version: mvn35
446     stream: master
447     submodule-recursive: true
448
449     gerrit_verify_triggers:
450       - patchset-created-event:
451           exclude-drafts: true
452           exclude-trivial-rebase: false
453           exclude-no-code-change: false
454       - draft-published-event
455       - comment-added-contains-event:
456           comment-contains-value: '^Patch Set[ ]+[0-9]+:([ ]+|[\n]+)(recheck|reverify)$'
457
458     #####################
459     # Job Configuration #
460     #####################
461
462     concurrent: true
463     disabled: '{disable-job}'
464
465     builders:
466       - lf-infra-pre-build
467       - lf-maven-install:
468           mvn-version: '{mvn-version}'
469       - lf-update-java-alternatives:
470           java-version: '{java-version}'
471       - lf-provide-maven-settings:
472           global-settings-file: '{mvn-global-settings}'
473           settings-file: '{mvn-settings}'
474       - shell: !include-raw-escape:
475           - ../shell/common-variables.sh
476           - ../shell/maven-javadoc-generate.sh
477       - lf-provide-maven-settings-cleanup
478
479 - job-template:
480     name: '{project-name}-maven-javadoc-verify-{stream}'
481     id: gerrit-maven-javadoc-verify
482     <<: *lf_maven_common
483     # yamllint disable-line rule:key-duplicates
484     <<: *lf_maven_javadoc_verify
485
486     scm:
487       - lf-infra-gerrit-scm:
488           jenkins-ssh-credential: '{jenkins-ssh-credential}'
489           git-url: '{git-url}'
490           refspec: '$GERRIT_REFSPEC'
491           branch: '$GERRIT_BRANCH'
492           submodule-recursive: '{submodule-recursive}'
493           choosing-strategy: gerrit
494
495     triggers:
496       - gerrit:
497           server-name: '{gerrit-server-name}'
498           trigger-on: '{obj:gerrit_verify_triggers}'
499           projects:
500             - project-compare-type: ANT
501               project-pattern: '{project}'
502               branches:
503                 - branch-compare-type: ANT
504                   branch-pattern: '**/{branch}'
505
506 - job-template:
507     name: '{project-name}-maven-javadoc-verify-{stream}'
508     id: github-maven-javadoc-verify
509     <<: *lf_maven_common
510     # yamllint disable-line rule:key-duplicates
511     <<: *lf_maven_javadoc_verify
512
513     properties:
514       - lf-infra-properties:
515           build-days-to-keep: '{build-days-to-keep}'
516       - github:
517           url: '{github-url}/{github-org}/{project}'
518
519     scm:
520       - lf-infra-github-scm:
521           url: '{git-clone-url}{github-org}/{project}'
522           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
523           branch: '$sha1'
524           submodule-recursive: '{submodule-recursive}'
525           choosing-strategy: default
526           jenkins-ssh-credential: '{jenkins-ssh-credential}'
527
528     triggers:
529       - github-pull-request:
530           trigger-phrase: ^(recheck|reverify)$
531           only-trigger-phrase: false
532           status-context: 'Maven Javadoc Verify'
533           permit-all: true
534           github-hooks: true
535           white-list-target-branches:
536             - '{branch}'
537
538 ###############
539 # Maven Merge #
540 ###############
541
542 - lf_maven_merge: &lf_maven_merge
543     name: lf-maven-merge
544
545     ######################
546     # Default parameters #
547     ######################
548
549     branch: master
550     build-days-to-keep: 30  # 30 days in case we need to troubleshoot
551     build-timeout: 60
552     cron: '@daily'
553     disable-job: false
554     git-url: '$GIT_URL/$PROJECT'
555     github-url: 'https://github.com'
556     java-version: openjdk8
557     mvn-global-settings: global-settings
558     mvn-goals: clean deploy
559     mvn-opts: ''
560     mvn-params: '-Dmerge'
561     mvn-version: mvn35
562     nexus-cut-dirs: 6  # Number of dirs in the Nexus path to remove for wget -r.
563     stream: master
564     submodule-recursive: true
565
566     gerrit_merge_triggers:
567       - change-merged-event
568       - comment-added-contains-event:
569           comment-contains-value: remerge$
570
571     gerrit_trigger_file_paths:
572       - compare-type: REG_EXP
573         pattern: '.*'
574
575     # github_included_regions MUST match gerrit_trigger_file_paths
576     github_included_regions:
577       - '.*'
578
579     post_build_trigger: ''
580
581     #####################
582     # Job Configuration #
583     #####################
584
585     disabled: '{disable-job}'
586
587     builders:
588       - lf-infra-pre-build
589       - lf-jacoco-nojava-workaround
590       - lf-maven-install:
591           mvn-version: '{mvn-version}'
592       - lf-update-java-alternatives:
593           java-version: '{java-version}'
594       - lf-provide-maven-settings:
595           global-settings-file: '{mvn-global-settings}'
596           settings-file: '{mvn-settings}'
597       - lf-infra-create-netrc:
598           server-id: '{mvn-snapshot-id}'
599       - inject:
600           properties-content: |
601               NEXUS_CUT_DIRS={nexus-cut-dirs}
602               NEXUS_REPO={nexus-snapshot-repo}
603       - shell: !include-raw-escape: ../shell/maven-fetch-metadata.sh
604       - lf-maven-build:
605           mvn-goals: '{mvn-goals}'
606       - lf-maven-deploy
607       - lf-provide-maven-settings-cleanup
608
609     publishers:
610       - findbugs
611       - lf-jacoco-report
612       - lf-infra-publish
613       - trigger-parameterized-builds: '{obj:post_build_trigger}'
614
615 - job-template:
616     name: '{project-name}-maven-merge-{stream}'
617     id: gerrit-maven-merge
618     <<: *lf_maven_common
619     # yamllint disable-line rule:key-duplicates
620     <<: *lf_maven_merge
621
622     scm:
623       - lf-infra-gerrit-scm:
624           jenkins-ssh-credential: '{jenkins-ssh-credential}'
625           git-url: '{git-url}'
626           refspec: '$GERRIT_REFSPEC'
627           branch: '$GERRIT_BRANCH'
628           submodule-recursive: '{submodule-recursive}'
629           choosing-strategy: default
630
631     triggers:
632       - timed: '{obj:cron}'
633       - gerrit:
634           server-name: '{gerrit-server-name}'
635           trigger-on: '{obj:gerrit_merge_triggers}'
636           projects:
637             - project-compare-type: ANT
638               project-pattern: '{project}'
639               branches:
640                 - branch-compare-type: ANT
641                   branch-pattern: '**/{branch}'
642               file-paths: '{obj:gerrit_trigger_file_paths}'
643
644 - job-template:
645     name: '{project-name}-maven-merge-{stream}'
646     id: github-maven-merge
647     <<: *lf_maven_common
648     # yamllint disable-line rule:key-duplicates
649     <<: *lf_maven_merge
650
651     properties:
652       - lf-infra-properties:
653           build-days-to-keep: '{build-days-to-keep}'
654       - github:
655           url: '{github-url}/{github-org}/{project}'
656
657     scm:
658       - lf-infra-github-scm:
659           url: '{git-clone-url}{github-org}/{project}'
660           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
661           branch: '{branch}'
662           submodule-recursive: '{submodule-recursive}'
663           choosing-strategy: default
664           jenkins-ssh-credential: '{jenkins-ssh-credential}'
665
666     triggers:
667       - timed: '{obj:cron}'
668       - github
669       - pollscm:
670           cron: ''
671       - github-pull-request:
672           trigger-phrase: '^remerge$'
673           only-trigger-phrase: true
674           status-context: 'Maven Merge'
675           permit-all: true
676           github-hooks: true
677           org-list:
678             - '{github-org}'
679           white-list: '{obj:github_pr_whitelist}'
680           admin-list: '{obj:github_pr_admin_list}'
681           white-list-target-branches:
682             - '{branch}'
683           included-regions: '{obj:github_included_regions}'
684
685 ###############
686 # Maven Stage #
687 ###############
688
689 - lf_maven_stage: &lf_maven_stage
690     name: lf-maven-stage
691
692     ######################
693     # Default parameters #
694     ######################
695
696     branch: master
697     build-days-to-keep: 30  # 30 days in case a release takes long to get approved.
698     build-timeout: 60
699     cron: '@daily'
700     disable-job: false
701     git-url: '$GIT_URL/$PROJECT'
702     github-url: 'https://github.com'
703     java-version: openjdk8
704     mvn-global-settings: global-settings
705     mvn-goals: clean deploy
706     mvn-opts: ''
707     mvn-params: ''
708     mvn-version: mvn35
709     stream: master
710     submodule-recursive: true
711
712     gerrit_release_triggers:
713       - comment-added-contains-event:
714           comment-contains-value: stage-release$
715
716     #####################
717     # Job Configuration #
718     #####################
719
720     disabled: '{disable-job}'
721
722     parameters:
723       - lf-infra-parameters:
724           project: '{project}'
725           branch: '{branch}'
726           stream: '{stream}'
727           lftools-version: '{lftools-version}'
728       - lf-infra-maven-parameters:
729           mvn-opts: '{mvn-opts}'
730           mvn-params: '{mvn-params}'
731           mvn-version: '{mvn-version}'
732           staging-profile-id: '{staging-profile-id}'
733       - string:
734           name: ARCHIVE_ARTIFACTS
735           default: '{archive-artifacts}'
736           description: Artifacts to archive to the logs server.
737       - string:
738           name: STAGING_PROFILE_ID
739           default: '{staging-profile-id}'
740           description: Nexus staging profile ID.
741
742     builders:
743       - lf-infra-pre-build
744       - lf-jacoco-nojava-workaround
745       - lf-maven-install:
746           mvn-version: '{mvn-version}'
747       - lf-update-java-alternatives:
748           java-version: '{java-version}'
749       - lf-provide-maven-settings:
750           global-settings-file: '{mvn-global-settings}'
751           settings-file: '{mvn-settings}'
752       - lf-infra-create-netrc:
753           server-id: '{mvn-staging-id}'
754       - shell: !include-raw-escape: ../shell/maven-patch-release.sh
755       - lf-maven-build:
756           mvn-goals: '{mvn-goals}'
757       - lf-maven-stage
758       - lf-provide-maven-settings-cleanup
759
760 - job-template:
761     name: '{project-name}-maven-stage-{stream}'
762     id: gerrit-maven-stage
763     <<: *lf_maven_common
764     # yamllint disable-line rule:key-duplicates
765     <<: *lf_maven_stage
766
767     scm:
768       - lf-infra-gerrit-scm:
769           jenkins-ssh-credential: '{jenkins-ssh-credential}'
770           git-url: '{git-url}'
771           refspec: '$GERRIT_REFSPEC'
772           branch: '$GERRIT_BRANCH'
773           submodule-recursive: '{submodule-recursive}'
774           choosing-strategy: default
775
776     triggers:
777       - timed: '{obj:cron}'
778       - gerrit:
779           server-name: '{gerrit-server-name}'
780           trigger-on: '{obj:gerrit_release_triggers}'
781           projects:
782             - project-compare-type: ANT
783               project-pattern: '{project}'
784               branches:
785                 - branch-compare-type: ANT
786                   branch-pattern: '**/{branch}'
787
788 - job-template:
789     name: '{project-name}-maven-stage-{stream}'
790     id: github-maven-stage
791     <<: *lf_maven_common
792     # yamllint disable-line rule:key-duplicates
793     <<: *lf_maven_stage
794
795     properties:
796       - lf-infra-properties:
797           build-days-to-keep: '{build-days-to-keep}'
798       - github:
799           url: '{github-url}/{github-org}/{project}'
800
801     scm:
802       - lf-infra-github-scm:
803           url: '{git-clone-url}{github-org}/{project}'
804           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
805           branch: '{branch}'
806           submodule-recursive: '{submodule-recursive}'
807           choosing-strategy: default
808           jenkins-ssh-credential: '{jenkins-ssh-credential}'
809
810     triggers:
811       - timed: '{obj:cron}'
812       - github-pull-request:
813           trigger-phrase: '^build release$'
814           only-trigger-phrase: true
815           status-context: 'Maven Release'
816           permit-all: true
817           github-hooks: true
818           white-list-target-branches:
819             - '{branch}'
820
821 ###############
822 # Maven Sonar #
823 ###############
824
825 - lf_maven_sonar: &lf_maven_sonar
826     name: lf-maven-sonar
827
828     ######################
829     # Default parameters #
830     ######################
831
832     branch: master  # Sonar should always be run on master branch
833     build-days-to-keep: 7
834     build-timeout: 60
835     cron: 'H H * * 6'  # run weekly
836     disable-job: false
837     git-url: '$GIT_URL/$PROJECT'
838     github-url: 'https://github.com'
839     java-version: openjdk8
840     mvn-global-settings: global-settings
841     mvn-opts: ''
842     mvn-params: ''
843     mvn-version: mvn35
844     sonar-mvn-goal: 'sonar:sonar'
845     stream: master
846     submodule-recursive: true
847
848     gerrit_sonar_triggers:
849       - comment-added-contains-event:
850           comment-contains-value: run-sonar$
851
852     #####################
853     # Job Configuration #
854     #####################
855
856     disabled: '{disable-job}'
857
858     parameters:
859       - lf-infra-parameters:
860           project: '{project}'
861           branch: '{branch}'
862           stream: '{stream}'
863           lftools-version: '{lftools-version}'
864       - lf-infra-maven-parameters:
865           mvn-opts: '{mvn-opts}'
866           mvn-params: '{mvn-params}'
867           mvn-version: '{mvn-version}'
868       - string:
869           name: ARCHIVE_ARTIFACTS
870           default: '{archive-artifacts}'
871           description: Artifacts to archive to the logs server.
872       - string:
873           name: SONAR_MAVEN_GOAL
874           default: '{sonar-mvn-goal}'
875           description: |
876               Maven goals to pass to the Sonar call. Typically sonar:sonar
877               however to use a specific version of the sonar-maven-plugin we
878               can call "org.codehaus.mojo:sonar-maven-plugin:3.3.0.603:sonar".
879
880     triggers:
881       - timed: '{obj:cron}'
882       - gerrit:
883           server-name: '{gerrit-server-name}'
884           trigger-on: '{obj:gerrit_sonar_triggers}'
885           projects:
886             - project-compare-type: 'ANT'
887               project-pattern: '{project}'
888               branches:
889                 - branch-compare-type: 'ANT'
890                   branch-pattern: '**/master'
891           skip-vote:
892             successful: true
893             failed: true
894             unstable: true
895             notbuilt: true
896
897     builders:
898       - lf-infra-pre-build
899       - lf-infra-maven-sonar:
900           java-version: '{java-version}'
901           mvn-settings: '{mvn-settings}'
902           mvn-version: '{mvn-version}'
903
904     publishers:
905       - lf-jacoco-report
906       - findbugs
907       - lf-infra-publish
908
909 - builder:
910     name: lf-infra-maven-sonar
911     # Run a Sonar build with Maven
912     builders:
913       - lf-maven-install:
914           mvn-version: '{mvn-version}'
915       - lf-update-java-alternatives:
916           java-version: '{java-version}'
917       - inject:
918           # Switch this to the sonar wrapper when JJB 2.0 is available
919           properties-content: SONAR_HOST_URL=$SONAR_URL
920       - lf-provide-maven-settings:
921           global-settings-file: global-settings
922           settings-file: '{mvn-settings}'
923       - shell: !include-raw-escape:
924           - ../shell/common-variables.sh
925           - ../shell/maven-sonar.sh
926       - lf-provide-maven-settings-cleanup
927
928 - job-template:
929     name: '{project-name}-sonar'
930     id: gerrit-maven-sonar
931     <<: *lf_maven_common
932     # yamllint disable-line rule:key-duplicates
933     <<: *lf_maven_sonar
934
935     scm:
936       - lf-infra-gerrit-scm:
937           jenkins-ssh-credential: '{jenkins-ssh-credential}'
938           git-url: '{git-url}'
939           refspec: $GERRIT_REFSPEC
940           branch: $GERRIT_BRANCH
941           submodule-recursive: '{submodule-recursive}'
942           choosing-strategy: default
943
944 - job-template:
945     name: '{project-name}-sonar'
946     id: github-maven-sonar
947     <<: *lf_maven_common
948     # yamllint disable-line rule:key-duplicates
949     <<: *lf_maven_sonar
950
951     properties:
952       - lf-infra-properties:
953           build-days-to-keep: '{build-days-to-keep}'
954       - github:
955           url: '{github-url}/{github-org}/{project}'
956
957     scm:
958       - lf-infra-github-scm:
959           url: '{git-clone-url}{github-org}/{project}'
960           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
961           branch: '$sha1'
962           submodule-recursive: '{submodule-recursive}'
963           choosing-strategy: default
964           jenkins-ssh-credential: '{jenkins-ssh-credential}'
965
966     triggers:
967       - github-pull-request:
968           trigger-phrase: '^run-sonar$'
969           only-trigger-phrase: false
970           status-context: 'Maven Sonar'
971           permit-all: true
972           github-hooks: true
973           white-list-target-branches:
974             - '{branch}'
975
976 ################
977 # Maven Verify #
978 ################
979
980 - lf_maven_verify: &lf_maven_verify
981     name: lf-maven-verify
982
983     ######################
984     # Default parameters #
985     ######################
986
987     branch: master
988     build-days-to-keep: 7
989     build-timeout: 60
990     disable-job: false
991     git-url: '$GIT_URL/$PROJECT'
992     github-url: 'https://github.com'
993     java-version: openjdk8
994     mvn-global-settings: global-settings
995     mvn-goals: clean deploy
996     mvn-opts: ''
997     mvn-params: '-Dstream=$STREAM'
998     mvn-version: mvn35
999     stream: master
1000     submodule-recursive: true
1001
1002     gerrit_verify_triggers:
1003       - patchset-created-event:
1004           exclude-drafts: true
1005           exclude-trivial-rebase: false
1006           exclude-no-code-change: false
1007       - draft-published-event
1008       - comment-added-contains-event:
1009           comment-contains-value: '^Patch Set[ ]+[0-9]+:([ ]+|[\n]+)(recheck|reverify)$'
1010
1011     gerrit_trigger_file_paths:
1012       - compare-type: REG_EXP
1013         pattern: '.*'
1014
1015     # github_included_regions MUST match gerrit_trigger_file_paths
1016     github_included_regions:
1017       - '.*'
1018
1019     #####################
1020     # Job Configuration #
1021     #####################
1022
1023     concurrent: true
1024     disabled: '{disable-job}'
1025
1026     builders:
1027       - lf-infra-pre-build
1028       - lf-jacoco-nojava-workaround
1029       - lf-maven-install:
1030           mvn-version: '{mvn-version}'
1031       - lf-update-java-alternatives:
1032           java-version: '{java-version}'
1033       - lf-provide-maven-settings:
1034           global-settings-file: '{mvn-global-settings}'
1035           settings-file: '{mvn-settings}'
1036       - lf-maven-build:
1037           mvn-goals: '{mvn-goals}'
1038       - lf-provide-maven-settings-cleanup
1039
1040     publishers:
1041       - findbugs
1042       - lf-jacoco-report
1043       - lf-infra-publish
1044
1045 - job-template:
1046     name: '{project-name}-maven-verify-{stream}-{mvn-version}-{java-version}'
1047     id: gerrit-maven-verify
1048     <<: *lf_maven_common
1049     # yamllint disable-line rule:key-duplicates
1050     <<: *lf_maven_verify
1051
1052     scm:
1053       - lf-infra-gerrit-scm:
1054           jenkins-ssh-credential: '{jenkins-ssh-credential}'
1055           git-url: '{git-url}'
1056           refspec: '$GERRIT_REFSPEC'
1057           branch: '$GERRIT_BRANCH'
1058           submodule-recursive: '{submodule-recursive}'
1059           choosing-strategy: gerrit
1060
1061     triggers:
1062       - gerrit:
1063           server-name: '{gerrit-server-name}'
1064           trigger-on: '{obj:gerrit_verify_triggers}'
1065           projects:
1066             - project-compare-type: ANT
1067               project-pattern: '{project}'
1068               branches:
1069                 - branch-compare-type: ANT
1070                   branch-pattern: '**/{branch}'
1071               file-paths: '{obj:gerrit_trigger_file_paths}'
1072
1073 - job-template:
1074     name: '{project-name}-maven-verify-{stream}-{mvn-version}-{java-version}'
1075     id: github-maven-verify
1076     <<: *lf_maven_common
1077     # yamllint disable-line rule:key-duplicates
1078     <<: *lf_maven_verify
1079
1080     properties:
1081       - lf-infra-properties:
1082           build-days-to-keep: '{build-days-to-keep}'
1083       - github:
1084           url: '{github-url}/{github-org}/{project}'
1085
1086     scm:
1087       - lf-infra-github-scm:
1088           url: '{git-clone-url}{github-org}/{project}'
1089           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
1090           branch: '$sha1'
1091           submodule-recursive: '{submodule-recursive}'
1092           choosing-strategy: default
1093           jenkins-ssh-credential: '{jenkins-ssh-credential}'
1094
1095     triggers:
1096       - github-pull-request:
1097           trigger-phrase: '^(recheck|reverify)$'
1098           only-trigger-phrase: false
1099           status-context: 'Maven Verify'
1100           permit-all: true
1101           github-hooks: true
1102           white-list-target-branches:
1103             - '{branch}'
1104           included-regions: '{obj:github_included_regions}'
1105
1106 #############################
1107 # Maven Verify Dependencies #
1108 #############################
1109
1110 - lf_maven_verify_dependencies: &lf_maven_verify_dependencies
1111     name: lf-maven-verify-dependencies
1112
1113     ######################
1114     # Default parameters #
1115     ######################
1116
1117     branch: master
1118     build-days-to-keep: 7
1119     build-timeout: 60
1120     disable-job: false
1121     git-url: '$GIT_URL/$PROJECT'
1122     github-url: 'https://github.com'
1123     java-version: openjdk8
1124     mvn-global-settings: global-settings
1125     mvn-goals: clean deploy
1126     mvn-opts: ''
1127     mvn-params: '-Dstream=$STREAM'
1128     mvn-version: mvn35
1129     stream: master
1130     submodule-recursive: true
1131
1132     gerrit_verify_triggers:
1133       - comment-added-contains-event:
1134           comment-contains-value: 'recheck: [0-9 ]+'
1135     gerrit_trigger_file_paths:
1136       - compare-type: ANT
1137         pattern: '**'
1138
1139     #####################
1140     # Job Configuration #
1141     #####################
1142
1143     concurrent: true
1144     disabled: '{disable-job}'
1145
1146     builders:
1147       - lf-infra-pre-build
1148       - lf-jacoco-nojava-workaround
1149       - lf-maven-install:
1150           mvn-version: '{mvn-version}'
1151       - lf-update-java-alternatives:
1152           java-version: '{java-version}'
1153       - lf-provide-maven-settings:
1154           global-settings-file: '{mvn-global-settings}'
1155           settings-file: '{mvn-settings}'
1156       - lf-fetch-dependent-patches
1157       - shell: !include-raw-escape:
1158           - ../shell/common-variables.sh
1159           - ../shell/maven-build-deps.sh
1160       - lf-maven-build:
1161           mvn-goals: '{mvn-goals}'
1162       - lf-provide-maven-settings-cleanup
1163
1164     publishers:
1165       - findbugs
1166       - lf-jacoco-report
1167       - lf-infra-publish
1168
1169 - job-template:
1170     name: '{project-name}-maven-verify-deps-{stream}-{mvn-version}-{java-version}'
1171     id: gerrit-maven-verify-dependencies
1172     <<: *lf_maven_common
1173     # yamllint disable-line rule:key-duplicates
1174     <<: *lf_maven_verify_dependencies
1175
1176     scm:
1177       - lf-infra-gerrit-scm:
1178           jenkins-ssh-credential: '{jenkins-ssh-credential}'
1179           git-url: '{git-url}'
1180           refspec: '$GERRIT_REFSPEC'
1181           branch: '$GERRIT_BRANCH'
1182           submodule-recursive: '{submodule-recursive}'
1183           choosing-strategy: gerrit
1184
1185     triggers:
1186       - gerrit:
1187           server-name: '{gerrit-server-name}'
1188           trigger-on: '{obj:gerrit_verify_triggers}'
1189           projects:
1190             - project-compare-type: ANT
1191               project-pattern: '{project}'
1192               branches:
1193                 - branch-compare-type: ANT
1194                   branch-pattern: '**/{branch}'
1195               file-paths: '{obj:gerrit_trigger_file_paths}'