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