eaa4ef87a965d7277aba32c8fe3eeb18cf6ddfac
[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     jobs:
11       - gerrit-maven-clm
12       - gerrit-maven-release
13       - gerrit-maven-verify
14
15 - job-group:
16     name: '{project-name}-github-maven-jobs'
17
18     # This job group contains all the recommended jobs that should be deployed
19     # for any project ci that is using github.
20
21     jobs:
22       - github-maven-clm
23       - github-maven-release
24       - github-maven-verify
25
26 - job-group:
27     name: '{project-name}-maven-javadoc-jobs'
28
29     # This job group contains all the recommended jobs that should be deployed
30     # for any project ci.
31
32     jobs:
33       - gerrit-maven-javadoc-publish
34       - gerrit-maven-javadoc-verify
35
36 - job-group:
37     name: '{project-name}-github-maven-javadoc-jobs'
38
39     # This job group contains all the recommended jobs that should be deployed
40     # for any project ci.
41
42     jobs:
43       - github-maven-javadoc-publish
44       - github-maven-javadoc-verify
45
46 ####################
47 # COMMON FUNCTIONS #
48 ####################
49
50 - lf_maven_common: &lf_maven_common
51     name: lf-maven-common
52
53     project-type: freestyle
54     node: '{build-node}'
55     jdk: '{java-version}'
56
57     properties:
58       - lf-infra-properties:
59           build-days-to-keep: '{build-days-to-keep}'
60
61     parameters:
62       - lf-infra-parameters:
63           project: '{project}'
64           branch: '{branch}'
65           stream: '{stream}'
66           lftools-version: '{lftools-version}'
67       - lf-infra-maven-parameters:
68           mvn-opts: '{mvn-opts}'
69           mvn-params: '{mvn-params}'
70           mvn-version: '{mvn-version}'
71           # Staging repos do not make sense for CLM jobs so set it blank.
72           staging-profile-id: '{staging-profile-id}'
73
74     wrappers:
75       - lf-infra-wrappers:
76           build-timeout: '{build-timeout}'
77           jenkins-ssh-credential: '{jenkins-ssh-credential}'
78
79     publishers:
80       # TODO: Make email notification work.
81       # - lf-infra-email-notify:
82       #     email-recipients: '{email-recipients}'
83       #     email-prefix: '[releng]'
84       - lf-infra-publish
85
86 #############
87 # Maven CLM #
88 #############
89
90 - lf_maven_clm: &lf_maven_clm
91     name: lf-maven-clm
92
93     # Produces a CLM scan of the code into Nexus IQ Server.
94     #
95     # Required parameters:
96     #     build-node:    The node to run build on.
97     #     jenkins-ssh-credential: Credential to use for SSH. (Generally should
98     #                             be configured in defaults.yaml)
99     #     mvn-settings: The name of settings file containing credentials for
100     #                   the project.
101     #
102     # Optional parameters:
103     #     mvn-global-settings: The name of the Maven global settings to use for
104     #                          Maven configuration. (default: global-settings)
105
106     ######################
107     # Default parameters #
108     ######################
109
110     branch: master
111     build-days-to-keep: 30  # 30 days for troubleshooting purposes
112     build-timeout: 15
113     git-url: '$GIT_URL/$PROJECT'
114     java-version: openjdk8
115     mvn-global-settings: global-settings
116     mvn-opts: ''
117     mvn-params: ''
118     mvn-version: mvn33
119     stream: master
120     submodule-recursive: true
121
122     # Staging repos do not make sense for CLM jobs so set it blank.
123     staging-profile-id: ''
124
125     #####################
126     # Job Configuration #
127     #####################
128
129     triggers:
130       # Build weekly on Saturdays
131       - timed: 'H H * * 6'
132
133     builders:
134       - lf-maven-install:
135           mvn-version: '{mvn-version}'
136       - lf-provide-maven-settings:
137           global-settings-file: '{mvn-global-settings}'
138           settings-file: '{mvn-settings}'
139       - shell: !include-raw-escape:
140           - ../shell/common-variables.sh
141           - ../shell/sonatype-clm.sh
142       - lf-provide-maven-settings-cleanup
143       - shell: 'find . -regex ".*karaf/target" | xargs rm -rf'
144       - sonatype-clm:
145           application-name: '{project-name}'
146
147 - job-template:
148     name: '{project-name}-maven-clm-{stream}'
149     id: gerrit-maven-clm
150     <<: *lf_maven_common
151     # yamllint disable-line rule:key-duplicates
152     <<: *lf_maven_clm
153
154     scm:
155       - lf-infra-gerrit-scm:
156           jenkins-ssh-credential: '{jenkins-ssh-credential}'
157           git-url: '{git-url}'
158           refspec: '$GERRIT_REFSPEC'
159           branch: '$GERRIT_BRANCH'
160           submodule-recursive: '{submodule-recursive}'
161           choosing-strategy: default
162
163 - job-template:
164     name: '{project-name}-maven-clm-{stream}'
165     id: github-maven-clm
166     <<: *lf_maven_common
167     # yamllint disable-line rule:key-duplicates
168     <<: *lf_maven_clm
169
170     properties:
171       - github:
172           url: '{git-url}/{github-org}/{project}'
173
174     scm:
175       - lf-infra-github-scm:
176           url: '{git-clone-url}{github-org}/{project}'
177           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
178           branch: '{branch}'
179           submodule-recursive: '{submodule-recursive}'
180           choosing-strategy: default
181           jenkins-ssh-credential: '{jenkins-ssh-credential}'
182
183 #########################
184 # Maven Javadoc Publish #
185 #########################
186
187 - lf_maven_javadoc_publish: &lf_maven_javadoc_publish
188     name: lf-maven-javadoc-publish
189
190     # Produces and publishes javadocs for a Maven project.
191     #
192     # Expects javadocs to be available in $WORKSPACE/target/site/apidocs
193     #
194     # Required parameters:
195     #
196     #     :build-node: The node to run build on.
197     #     :javadoc-path: The path in Nexus to deploy javadoc to.
198     #     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
199     #                              be configured in defaults.yaml)
200     #     :mvn-settings: The name of settings file containing credentials for
201     #                    the project.
202     #     :mvn-site-id: Maven Server ID from settings.xml to pull credentials from.
203     #         (Note: This setting should be configured in defaults.yaml.)
204     #
205     # Optional parameters:
206     #
207     #     :branch: The branch to build against. (default: master)
208     #     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
209     #     :build-timeout: Timeout in seconds before aborting build. (default: 60)
210     #     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
211     #     :java-version: Version of Java to use for the build. (default: openjdk8)
212     #     :mvn-global-settings: The name of the Maven global settings to use for
213     #         Maven configuration. (default: global-settings)
214     #     :mvn-opts: Sets MAVEN_OPTS. (default: '')
215     #     :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
216     #     :mvn-version: Version of maven to use. (default: mvn33)
217     #     :submodule-recursive: Whether to checkout submodules recursively.
218     #         (default: true)
219     #
220     #     :gerrit_javadoc_merge_triggers: Override Gerrit Triggers.
221
222     ######################
223     # Default parameters #
224     ######################
225
226     branch: master
227     build-days-to-keep: 30  # 30 days in case a release takes long to get approved.
228     build-timeout: 30
229     git-url: '$GIT_URL/$PROJECT'
230     java-version: openjdk8
231     mvn-global-settings: global-settings
232     mvn-opts: ''
233     mvn-params: ''
234     mvn-version: mvn33
235     staging-profile-id: ''  # Unused by the javadoc jobs
236     stream: master
237     submodule-recursive: true
238
239     gerrit_javadoc_merge_triggers:
240       - change-merged-event
241       - comment-added-contains-event:
242           comment-contains-value: remerge$
243
244     #####################
245     # Job Configuration #
246     #####################
247
248     builders:
249       - lf-maven-install:
250           mvn-version: '{mvn-version}'
251       - lf-provide-maven-settings:
252           global-settings-file: '{mvn-global-settings}'
253           settings-file: '{mvn-settings}'
254       - lf-infra-create-netrc:
255           server-id: '{mvn-site-id}'
256       - inject:
257           properties-content: 'DEPLOY_PATH={javadoc-path}'
258       - shell: !include-raw-escape:
259           - ../shell/common-variables.sh
260           - ../shell/maven-javadoc-generate.sh
261           - ../shell/lftools-install.sh
262           - ../shell/maven-javadoc-publish.sh
263       - lf-provide-maven-settings-cleanup
264
265 - job-template:
266     name: '{project-name}-maven-javadoc-publish-{stream}'
267     id: gerrit-maven-javadoc-publish
268     <<: *lf_maven_common
269     # yamllint disable-line rule:key-duplicates
270     <<: *lf_maven_javadoc_publish
271
272     git-url: '$GIT_URL/$GERRIT_PROJECT'
273
274     scm:
275       - lf-infra-gerrit-scm:
276           git-url: '{git-url}'
277           refspec: ''
278           branch: '{branch}'
279           submodule-recursive: '{submodule-recursive}'
280           choosing-strategy: default
281           jenkins-ssh-credential: '{jenkins-ssh-credential}'
282
283     triggers:
284       - gerrit:
285           server-name: '{gerrit-server-name}'
286           trigger-on: '{obj:gerrit_javadoc_merge_triggers}'
287           projects:
288             - project-compare-type: ANT
289               project-pattern: '{project}'
290               branches:
291                 - branch-compare-type: ANT
292                   branch-pattern: '**/{branch}'
293
294 - job-template:
295     name: '{project-name}-maven-javadoc-publish-{stream}'
296     id: github-maven-javadoc-publish
297     <<: *lf_maven_common
298     # yamllint disable-line rule:key-duplicates
299     <<: *lf_maven_javadoc_publish
300
301     properties:
302       - github:
303           url: '{git-url}/{github-org}/{project}'
304
305     scm:
306       - lf-infra-github-scm:
307           url: '{git-clone-url}{github-org}/{project}'
308           refspec: ''
309           branch: '{branch}'
310           submodule-recursive: '{submodule-recursive}'
311           choosing-strategy: default
312           jenkins-ssh-credential: '{jenkins-ssh-credential}'
313
314     triggers:
315       - github
316       - pollscm:
317           cron: ''
318       - lf-infra-github-pr-trigger:
319           trigger-phrase: '^remerge$'
320           only-trigger-phrase: true
321           status-context: 'JJB Merge'
322           permit-all: false
323           github-hooks: true
324           github-org: '{github-org}'
325           github_pr_whitelist: '{obj:github_pr_whitelist}'
326           github_pr_admin_list: '{obj:github_pr_admin_list}'
327
328 ########################
329 # Maven Javadoc Verify #
330 ########################
331
332 - lf_maven_javadoc_verify: &lf_maven_javadoc_verify
333     name: lf-maven-javadoc-verify
334
335     # Produces javadocs for a Maven project.
336     #
337     # Expects javadocs to be available in $WORKSPACE/target/site/apidocs
338     #
339     # Required parameters:
340     #     build-node:    The node to run build on.
341     #     jenkins-ssh-credential: Credential to use for SSH. (Generally should
342     #                             be configured in defaults.yaml)
343     #     mvn-settings: The name of settings file containing credentials for
344     #                   the project.
345     #
346     # Optional parameters:
347     #
348     #     :branch: The branch to build against. (default: master)
349     #     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
350     #     :build-timeout: Timeout in seconds before aborting build. (default: 60)
351     #     :deploy-path:    The path in Nexus to deploy javadoc to. (default: $PROJECT/$STREAM)
352     #     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
353     #     :java-version: Version of Java to use for the build. (default: openjdk8)
354     #     :mvn-global-settings: The name of the Maven global settings to use for
355     #         Maven configuration. (default: global-settings)
356     #     :mvn-opts: Sets MAVEN_OPTS. (default: '')
357     #     :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
358     #     :mvn-version: Version of maven to use. (default: mvn33)
359     #     :submodule-recursive: Whether to checkout submodules recursively.
360     #         (default: true)
361     #
362     #     :gerrit_javadoc_verify_triggers: Override Gerrit Triggers.
363
364     ######################
365     # Default parameters #
366     ######################
367
368     branch: master
369     build-days-to-keep: 30  # 30 days in case a release takes long to get approved.
370     build-timeout: 30
371     git-url: '$GIT_URL/$PROJECT'
372     java-version: openjdk8
373     mvn-global-settings: global-settings
374     mvn-opts: ''
375     mvn-params: ''
376     mvn-version: mvn33
377     staging-profile-id: ''  # Unused by the javadoc jobs
378     stream: master
379     submodule-recursive: true
380
381     gerrit_javadoc_verify_triggers:
382       - patchset-created-event:
383           exclude-drafts: true
384           exclude-trivial-rebase: false
385           exclude-no-code-change: false
386       - draft-published-event
387       - comment-added-contains-event:
388           comment-contains-value: recheck$
389
390     #####################
391     # Job Configuration #
392     #####################
393
394     builders:
395       - lf-maven-install:
396           mvn-version: '{mvn-version}'
397       - lf-provide-maven-settings:
398           global-settings-file: '{mvn-global-settings}'
399           settings-file: '{mvn-settings}'
400       - shell: !include-raw-escape:
401           - ../shell/common-variables.sh
402           - ../shell/maven-javadoc-generate.sh
403       - lf-provide-maven-settings-cleanup
404
405 - job-template:
406     name: '{project-name}-maven-javadoc-verify-{stream}'
407     id: gerrit-maven-javadoc-verify
408     <<: *lf_maven_common
409     # yamllint disable-line rule:key-duplicates
410     <<: *lf_maven_javadoc_verify
411
412     scm:
413       - lf-infra-gerrit-scm:
414           jenkins-ssh-credential: '{jenkins-ssh-credential}'
415           git-url: '{git-url}'
416           refspec: '$GERRIT_REFSPEC'
417           branch: '$GERRIT_BRANCH'
418           submodule-recursive: '{submodule-recursive}'
419           choosing-strategy: gerrit
420
421     triggers:
422       - gerrit:
423           server-name: '{gerrit-server-name}'
424           trigger-on: '{obj:gerrit_javadoc_verify_triggers}'
425           projects:
426             - project-compare-type: ANT
427               project-pattern: '{project}'
428               branches:
429                 - branch-compare-type: ANT
430                   branch-pattern: '**/{branch}'
431
432 - job-template:
433     name: '{project-name}-maven-javadoc-verify-{stream}'
434     id: github-maven-javadoc-verify
435     <<: *lf_maven_common
436     # yamllint disable-line rule:key-duplicates
437     <<: *lf_maven_javadoc_verify
438
439     properties:
440       - github:
441           url: '{git-url}/{github-org}/{project}'
442
443     scm:
444       - lf-infra-github-scm:
445           url: '{git-clone-url}{github-org}/{project}'
446           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
447           branch: '{branch}'
448           submodule-recursive: '{submodule-recursive}'
449           choosing-strategy: default
450           jenkins-ssh-credential: '{jenkins-ssh-credential}'
451
452     triggers:
453       - lf-infra-github-pr-trigger:
454           trigger-phrase: '^recheck$'
455           only-trigger-phrase: true
456           status-context: 'Maven Javadoc'
457           permit-all: true
458           github-hooks: true
459           github-org: ''
460           github_pr_whitelist:
461             - ''
462           github_pr_admin_list:
463             - ''
464
465 #################
466 # Maven Release #
467 #################
468
469 - lf_maven_release: &lf_maven_release
470     name: lf-maven-release
471
472     # Produces a release candidate by creating a staging repo in Nexus.
473     #
474     # Runs a Maven build and deploys to $WORKSPACE/m2repo directory. This
475     # directory can then be reused later to deploy to Nexus.
476     #
477     # Required parameters:
478     #     :build-node: The node to run build on.
479     #     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
480     #                              be configured in defaults.yaml)
481     #     :mvn-settings: The name of settings file containing credentials for
482     #                    the project.
483     #     :mvn-staging-id: Maven Server ID from settings.xml to pull credentials from.
484     #         (Note: This setting should be configured in defaults.yaml.)
485     #     :staging-profile-id: Profile ID of the project's Nexus staging profile.
486     #
487     # Optional parameters:
488     #     :gerrit_verify_triggers: Override Gerrit Triggers.
489     #     :mvn-global-settings: The name of the Maven global settings to use for
490     #                           Maven configuration. (default: global-settings)
491     #     :cron: Cron schedule when to trigger the job. This parameter also
492     #         supports multiline input via YAML pipe | character in cases where
493     #         one may want to provide more than 1 cron timer. (default: '')
494
495     ######################
496     # Default parameters #
497     ######################
498
499     branch: master
500     build-days-to-keep: 30  # 30 days in case a release takes long to get approved.
501     build-timeout: 30
502     git-url: '$GIT_URL/$PROJECT'
503     java-version: openjdk8
504     mvn-global-settings: global-settings
505     mvn-opts: ''
506     mvn-params: ''
507     mvn-version: mvn33
508     stream: master
509     submodule-recursive: true
510     cron: ''
511
512     gerrit_release_triggers:
513       - comment-added-contains-event:
514           comment-contains-value: build release$
515
516     #####################
517     # Job Configuration #
518     #####################
519
520     builders:
521       - lf-jacoco-nojava-workaround
522       - lf-maven-install:
523           mvn-version: '{mvn-version}'
524       - lf-provide-maven-settings:
525           global-settings-file: '{mvn-global-settings}'
526           settings-file: '{mvn-settings}'
527       - lf-infra-create-netrc:
528           server-id: '{mvn-staging-id}'
529       - shell: !include-raw-escape:
530           - ../shell/lftools-install.sh
531           - ../shell/common-variables.sh
532           - ../shell/maven-patch-release.sh
533           - ../shell/maven-build.sh
534           - ../shell/maven-stage.sh
535       - lf-provide-maven-settings-cleanup
536
537 - job-template:
538     name: '{project-name}-maven-release-{stream}'
539     id: gerrit-maven-release
540     <<: *lf_maven_common
541     # yamllint disable-line rule:key-duplicates
542     <<: *lf_maven_release
543
544     scm:
545       - lf-infra-gerrit-scm:
546           jenkins-ssh-credential: '{jenkins-ssh-credential}'
547           git-url: '{git-url}'
548           refspec: '$GERRIT_REFSPEC'
549           branch: '$GERRIT_BRANCH'
550           submodule-recursive: '{submodule-recursive}'
551           choosing-strategy: default
552
553     triggers:
554       - timed: '{obj:cron}'
555       - gerrit:
556           server-name: '{gerrit-server-name}'
557           trigger-on: '{obj:gerrit_release_triggers}'
558           projects:
559             - project-compare-type: ANT
560               project-pattern: '{project}'
561               branches:
562                 - branch-compare-type: ANT
563                   branch-pattern: '**/{branch}'
564
565 - job-template:
566     name: '{project-name}-maven-release-{stream}'
567     id: github-maven-release
568     <<: *lf_maven_common
569     # yamllint disable-line rule:key-duplicates
570     <<: *lf_maven_release
571
572     properties:
573       - github:
574           url: '{git-url}/{github-org}/{project}'
575
576     scm:
577       - lf-infra-github-scm:
578           url: '{git-clone-url}{github-org}/{project}'
579           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
580           branch: '{branch}'
581           submodule-recursive: '{submodule-recursive}'
582           choosing-strategy: default
583           jenkins-ssh-credential: '{jenkins-ssh-credential}'
584
585     triggers:
586       - timed: '{obj:cron}'
587       - lf-infra-github-pr-trigger:
588           trigger-phrase: '^build release$'
589           only-trigger-phrase: true
590           status-context: 'Maven Release'
591           permit-all: true
592           github-hooks: true
593           github-org: ''
594           github_pr_whitelist:
595             - ''
596           github_pr_admin_list:
597             - ''
598
599 ###############
600 # Maven Sonar #
601 ###############
602
603 - lf_maven_sonar: &lf_maven_sonar
604     name: lf-maven-sonar
605
606     # Sonar job which runs mvn clean install then publishes to Sonar.
607     #
608     # This job purposely only runs on the master branch as there are Additional
609     # configuration needed to support multiple branches and there's not much
610     # interest in that kind of support.
611     #
612     # Required parameters:
613     #
614     #     :build-node: The node to run build on.
615     #     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
616     #         be configured in defaults.yaml)
617     #     :mvn-settings: The name of settings file containing credentials for
618     #         the project.
619     #
620     # Optional parameters:
621     #
622     #     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
623     #     :build-timeout: Timeout in seconds before aborting build. (default: 60)
624     #     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
625     #     :java-version: Version of Java to use for the build. (default: openjdk8)
626     #     :mvn-global-settings: The name of the Maven global settings to use for
627     #         Maven configuration. (default: global-settings)
628     #     :mvn-opts: Sets MAVEN_OPTS. (default: '')
629     #     :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
630     #     :mvn-version: Version of maven to use. (default: mvn33)
631     #     :submodule-recursive: Whether to checkout submodules recursively.
632     #         (default: true)
633     #
634     #     :gerrit_sonar_triggers: Override Gerrit Triggers.
635
636     ######################
637     # Default parameters #
638     ######################
639
640     branch: master  # Sonar should always be run on master branch
641     build-days-to-keep: 7
642     build-timeout: 30
643     git-url: '$GIT_URL/$PROJECT'
644     java-version: openjdk8
645     mvn-global-settings: global-settings
646     mvn-opts: ''
647     mvn-params: ''
648     mvn-version: mvn33
649     stream: master
650     submodule-recursive: true
651
652     gerrit_sonar_triggers:
653       - comment-added-contains-event:
654           comment-contains-value: run-sonar$
655
656     # Staging repos do not make sense for CLM jobs so set it blank.
657     staging-profile-id: ''
658
659     #####################
660     # Job Configuration #
661     #####################
662
663     triggers:
664       - timed: 'H H * * 6'
665       - gerrit:
666           server-name: '{gerrit-server-name}'
667           trigger-on: '{obj:gerrit_sonar_triggers}'
668           projects:
669             - project-compare-type: 'ANT'
670               project-pattern: '{project}'
671               branches:
672                 - branch-compare-type: 'ANT'
673                   branch-pattern: '**/master'
674           skip-vote:
675             successful: true
676             failed: true
677             unstable: true
678             notbuilt: true
679
680     builders:
681       - lf-infra-maven-sonar:
682           mvn-settings: '{mvn-settings}'
683           mvn-version: '{mvn-version}'
684
685     publishers:
686       - lf-jacoco-report
687       - findbugs
688       - lf-infra-publish
689
690 - builder:
691     name: lf-infra-maven-sonar
692     # Run a Sonar build with Maven
693     builders:
694       - lf-maven-install:
695           mvn-version: '{mvn-version}'
696       - inject:
697           # Switch this to the sonar wrapper when JJB 2.0 is available
698           properties-content: |
699               SONAR_HOST_URL=$SONAR_URL
700               SONAR_MAVEN_GOAL=sonar:sonar
701       - lf-provide-maven-settings:
702           global-settings-file: global-settings
703           settings-file: '{mvn-settings}'
704       - shell: !include-raw-escape:
705           - ../shell/common-variables.sh
706           - ../shell/maven-sonar.sh
707       - lf-provide-maven-settings-cleanup
708
709 - job-template:
710     name: '{project-name}-sonar'
711     id: gerrit-maven-sonar
712     <<: *lf_maven_common
713     # yamllint disable-line rule:key-duplicates
714     <<: *lf_maven_sonar
715
716     scm:
717       - lf-infra-gerrit-scm:
718           jenkins-ssh-credential: '{jenkins-ssh-credential}'
719           git-url: '{git-url}'
720           refspec: $GERRIT_REFSPEC
721           branch: $GERRIT_BRANCH
722           submodule-recursive: '{submodule-recursive}'
723           choosing-strategy: default
724
725 - job-template:
726     name: '{project-name}-sonar'
727     id: github-maven-sonar
728     <<: *lf_maven_common
729     # yamllint disable-line rule:key-duplicates
730     <<: *lf_maven_sonar
731
732     properties:
733       - github:
734           url: '{git-url}/{github-org}/{project}'
735
736     scm:
737       - lf-infra-github-scm:
738           url: '{git-clone-url}{github-org}/{project}'
739           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
740           branch: '{branch}'
741           submodule-recursive: '{submodule-recursive}'
742           choosing-strategy: default
743           jenkins-ssh-credential: '{jenkins-ssh-credential}'
744
745     triggers:
746       - lf-infra-github-pr-trigger:
747           trigger-phrase: '^recheck$'
748           only-trigger-phrase: false
749           status-context: 'Maven Verify'
750           permit-all: true
751           github-hooks: true
752           github-org: ''
753           github_pr_whitelist:
754             - ''
755           github_pr_admin_list:
756             - ''
757
758 ################
759 # Maven Verify #
760 ################
761
762 - lf_maven_verify: &lf_maven_verify
763     name: lf-maven-verify
764
765     # Verify job which runs mvn clean install to test a project build..
766     #
767     # Required parameters:
768     #
769     #     :build-node: The node to run build on.
770     #     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
771     #         be configured in defaults.yaml)
772     #     :mvn-settings: The name of settings file containing credentials for
773     #         the project.
774     #
775     # Optional parameters:
776     #
777     #     :branch: Git branch to fetch for the build. (default: master)
778     #     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
779     #     :build-timeout: Timeout in seconds before aborting build. (default: 60)
780     #     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
781     #     :java-version: Version of Java to use for the build. (default: openjdk8)
782     #     :mvn-global-settings: The name of the Maven global settings to use for
783     #         Maven configuration. (default: global-settings)
784     #     :mvn-opts: Sets MAVEN_OPTS. (default: '')
785     #     :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
786     #     :mvn-version: Version of maven to use. (default: mvn33)
787     #     :stream: Keyword that can be used to represent a release code-name.
788     #         Often the same as the branch. (default: master)
789     #     :submodule-recursive: Whether to checkout submodules recursively.
790     #         (default: true)
791     #
792     #     :gerrit_verify_triggers: Override Gerrit Triggers.
793     #     :gerrit_trigger_file_paths: Override file paths which can be used to
794     #         filter which file modifications will trigger a build.
795
796     ######################
797     # Default parameters #
798     ######################
799
800     branch: master
801     build-days-to-keep: 7
802     build-timeout: 60
803     git-url: '$GIT_URL/$PROJECT'
804     java-version: openjdk8
805     mvn-global-settings: global-settings
806     mvn-opts: ''
807     mvn-params: '-Dstream=$STREAM'
808     mvn-version: mvn33
809     stream: master
810     submodule-recursive: true
811
812     gerrit_verify_triggers:
813       - patchset-created-event:
814           exclude-drafts: true
815           exclude-trivial-rebase: false
816           exclude-no-code-change: false
817       - draft-published-event
818       - comment-added-contains-event:
819           comment-contains-value: recheck$
820     gerrit_trigger_file_paths:
821       - compare-type: ANT
822         pattern: '**'
823
824     #####################
825     # Job Configuration #
826     #####################
827
828     concurrent: true
829
830     builders:
831       - lf-jacoco-nojava-workaround
832       - lf-maven-install:
833           mvn-version: '{mvn-version}'
834       - lf-provide-maven-settings:
835           global-settings-file: '{mvn-global-settings}'
836           settings-file: '{mvn-settings}'
837       - shell: !include-raw-escape:
838           - ../shell/lftools-install.sh
839           - ../shell/common-variables.sh
840           - ../shell/maven-build.sh
841       - lf-provide-maven-settings-cleanup
842
843     publishers:
844       - findbugs
845       - lf-jacoco-report
846       - lf-infra-publish
847
848 - job-template:
849     name: '{project-name}-maven-verify-{stream}-{mvn-version}-{java-version}'
850     id: gerrit-maven-verify
851     <<: *lf_maven_common
852     # yamllint disable-line rule:key-duplicates
853     <<: *lf_maven_verify
854
855     scm:
856       - lf-infra-gerrit-scm:
857           jenkins-ssh-credential: '{jenkins-ssh-credential}'
858           git-url: '{git-url}'
859           refspec: '$GERRIT_REFSPEC'
860           branch: '$GERRIT_BRANCH'
861           submodule-recursive: '{submodule-recursive}'
862           choosing-strategy: gerrit
863
864     triggers:
865       - gerrit:
866           server-name: '{gerrit-server-name}'
867           trigger-on: '{obj:gerrit_verify_triggers}'
868           projects:
869             - project-compare-type: ANT
870               project-pattern: '{project}'
871               branches:
872                 - branch-compare-type: ANT
873                   branch-pattern: '**/{branch}'
874               file-paths: '{obj:gerrit_trigger_file_paths}'
875
876 - job-template:
877     name: '{project-name}-maven-verify-{stream}-{mvn-version}-{java-version}'
878     id: github-maven-verify
879     <<: *lf_maven_common
880     # yamllint disable-line rule:key-duplicates
881     <<: *lf_maven_verify
882
883     properties:
884       - github:
885           url: '{git-url}/{github-org}/{project}'
886
887     scm:
888       - lf-infra-github-scm:
889           url: '{git-clone-url}{github-org}/{project}'
890           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
891           branch: '{branch}'
892           submodule-recursive: '{submodule-recursive}'
893           choosing-strategy: default
894           jenkins-ssh-credential: '{jenkins-ssh-credential}'
895
896     triggers:
897       - lf-infra-github-pr-trigger:
898           trigger-phrase: '^recheck$'
899           only-trigger-phrase: false
900           status-context: 'Maven Verify'
901           permit-all: true
902           github-hooks: true
903           github-org: ''
904           github_pr_whitelist:
905             - ''
906           github_pr_admin_list:
907             - ''