Merge "DO NOT hardcode mvn staging server id"
[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     stream: master
236     submodule-recursive: true
237
238     gerrit_javadoc_merge_triggers:
239       - change-merged-event
240       - comment-added-contains-event:
241           comment-contains-value: remerge$
242
243     #####################
244     # Job Configuration #
245     #####################
246
247     builders:
248       - lf-maven-install:
249           mvn-version: '{mvn-version}'
250       - lf-provide-maven-settings:
251           global-settings-file: '{mvn-global-settings}'
252           settings-file: '{mvn-settings}'
253       - lf-infra-create-netrc:
254           server-id: '{mvn-site-id}'
255       - inject:
256           properties-content: 'DEPLOY_PATH={javadoc-path}'
257       - shell: !include-raw-escape:
258           - ../shell/common-variables.sh
259           - ../shell/maven-javadoc-generate.sh
260           - ../shell/lftools-install.sh
261           - ../shell/maven-javadoc-publish.sh
262       - lf-provide-maven-settings-cleanup
263
264 - job-template:
265     name: '{project-name}-maven-javadoc-publish-{stream}'
266     id: gerrit-maven-javadoc-publish
267     <<: *lf_maven_common
268     # yamllint disable-line rule:key-duplicates
269     <<: *lf_maven_javadoc_publish
270
271     git-url: '$GIT_URL/$GERRIT_PROJECT'
272
273     scm:
274       - lf-infra-gerrit-scm:
275           git-url: '{git-url}'
276           refspec: ''
277           branch: '{branch}'
278           submodule-recursive: '{submodule-recursive}'
279           choosing-strategy: default
280           jenkins-ssh-credential: '{jenkins-ssh-credential}'
281
282     triggers:
283       - gerrit:
284           server-name: '{gerrit-server-name}'
285           trigger-on: '{obj:gerrit_javadoc_merge_triggers}'
286           projects:
287             - project-compare-type: ANT
288               project-pattern: '{project}'
289               branches:
290                 - branch-compare-type: ANT
291                   branch-pattern: '**/{branch}'
292
293 - job-template:
294     name: '{project-name}-maven-javadoc-publish-{stream}'
295     id: github-maven-javadoc-publish
296     <<: *lf_maven_common
297     # yamllint disable-line rule:key-duplicates
298     <<: *lf_maven_javadoc_publish
299
300     properties:
301       - github:
302           url: '{git-url}/{github-org}/{project}'
303
304     scm:
305       - lf-infra-github-scm:
306           url: '{git-clone-url}{github-org}/{project}'
307           refspec: ''
308           branch: '{branch}'
309           submodule-recursive: '{submodule-recursive}'
310           choosing-strategy: default
311           jenkins-ssh-credential: '{jenkins-ssh-credential}'
312
313     triggers:
314       - github
315       - pollscm:
316           cron: ''
317       - lf-infra-github-pr-trigger:
318           trigger-phrase: '^remerge$'
319           only-trigger-phrase: true
320           status-context: 'JJB Merge'
321           permit-all: false
322           github-hooks: true
323           github-org: '{github-org}'
324           github_pr_whitelist: '{obj:github_pr_whitelist}'
325           github_pr_admin_list: '{obj:github_pr_admin_list}'
326
327 ########################
328 # Maven Javadoc Verify #
329 ########################
330
331 - lf_maven_javadoc_verify: &lf_maven_javadoc_verify
332     name: lf-maven-javadoc-verify
333
334     # Produces javadocs for a Maven project.
335     #
336     # Expects javadocs to be available in $WORKSPACE/target/site/apidocs
337     #
338     # Required parameters:
339     #     build-node:    The node to run build on.
340     #     jenkins-ssh-credential: Credential to use for SSH. (Generally should
341     #                             be configured in defaults.yaml)
342     #     mvn-settings: The name of settings file containing credentials for
343     #                   the project.
344     #
345     # Optional parameters:
346     #
347     #     :branch: The branch to build against. (default: master)
348     #     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
349     #     :build-timeout: Timeout in seconds before aborting build. (default: 60)
350     #     :deploy-path:    The path in Nexus to deploy javadoc to. (default: $PROJECT/$STREAM)
351     #     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
352     #     :java-version: Version of Java to use for the build. (default: openjdk8)
353     #     :mvn-global-settings: The name of the Maven global settings to use for
354     #         Maven configuration. (default: global-settings)
355     #     :mvn-opts: Sets MAVEN_OPTS. (default: '')
356     #     :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
357     #     :mvn-version: Version of maven to use. (default: mvn33)
358     #     :submodule-recursive: Whether to checkout submodules recursively.
359     #         (default: true)
360     #
361     #     :gerrit_javadoc_verify_triggers: Override Gerrit Triggers.
362
363     ######################
364     # Default parameters #
365     ######################
366
367     branch: master
368     build-days-to-keep: 30  # 30 days in case a release takes long to get approved.
369     build-timeout: 30
370     git-url: '$GIT_URL/$PROJECT'
371     java-version: openjdk8
372     mvn-global-settings: global-settings
373     mvn-opts: ''
374     mvn-params: ''
375     mvn-version: mvn33
376     stream: master
377     submodule-recursive: true
378
379     gerrit_javadoc_verify_triggers:
380       - patchset-created-event:
381           exclude-drafts: false
382           exclude-trivial-rebase: false
383           exclude-no-code-change: false
384       - draft-published-event
385       - comment-added-contains-event:
386           comment-contains-value: recheck$
387
388     #####################
389     # Job Configuration #
390     #####################
391
392     builders:
393       - lf-maven-install:
394           mvn-version: '{mvn-version}'
395       - lf-provide-maven-settings:
396           global-settings-file: '{mvn-global-settings}'
397           settings-file: '{mvn-settings}'
398       - shell: !include-raw-escape:
399           - ../shell/common-variables.sh
400           - ../shell/maven-javadoc-generate.sh
401       - lf-provide-maven-settings-cleanup
402
403 - job-template:
404     name: '{project-name}-maven-javadoc-verify-{stream}'
405     id: gerrit-maven-javadoc-verify
406     <<: *lf_maven_common
407     # yamllint disable-line rule:key-duplicates
408     <<: *lf_maven_javadoc_verify
409
410     scm:
411       - lf-infra-gerrit-scm:
412           jenkins-ssh-credential: '{jenkins-ssh-credential}'
413           git-url: '{git-url}'
414           refspec: '$GERRIT_REFSPEC'
415           branch: '$GERRIT_BRANCH'
416           submodule-recursive: '{submodule-recursive}'
417           choosing-strategy: gerrit
418
419     triggers:
420       - gerrit:
421           server-name: '{gerrit-server-name}'
422           trigger-on: '{obj:gerrit_javadoc_verify_triggers}'
423           projects:
424             - project-compare-type: ANT
425               project-pattern: '{project}'
426               branches:
427                 - branch-compare-type: ANT
428                   branch-pattern: '**/{branch}'
429
430 - job-template:
431     name: '{project-name}-maven-javadoc-verify-{stream}'
432     id: github-maven-javadoc-verify
433     <<: *lf_maven_common
434     # yamllint disable-line rule:key-duplicates
435     <<: *lf_maven_javadoc_verify
436
437     properties:
438       - github:
439           url: '{git-url}/{github-org}/{project}'
440
441     scm:
442       - lf-infra-github-scm:
443           url: '{git-clone-url}{github-org}/{project}'
444           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
445           branch: '{branch}'
446           submodule-recursive: '{submodule-recursive}'
447           choosing-strategy: default
448           jenkins-ssh-credential: '{jenkins-ssh-credential}'
449
450     triggers:
451       - lf-infra-github-pr-trigger:
452           trigger-phrase: '^recheck$'
453           only-trigger-phrase: true
454           status-context: 'Maven Javadoc'
455           permit-all: true
456           github-hooks: true
457           github-org: ''
458           github_pr_whitelist:
459             - ''
460           github_pr_admin_list:
461             - ''
462
463 #################
464 # Maven Release #
465 #################
466
467 - lf_maven_release: &lf_maven_release
468     name: lf-maven-release
469
470     # Produces a release candidate by creating a staging repo in Nexus.
471     #
472     # Runs a Maven build and deploys to $WORKSPACE/m2repo directory. This
473     # directory can then be reused later to deploy to Nexus.
474     #
475     # Required parameters:
476     #     :build-node: The node to run build on.
477     #     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
478     #                              be configured in defaults.yaml)
479     #     :mvn-settings: The name of settings file containing credentials for
480     #                    the project.
481     #     :mvn-staging-id: Maven Server ID from settings.xml to pull credentials from.
482     #         (Note: This setting should be configured in defaults.yaml.)
483     #     :staging-profile-id: Profile ID of the project's Nexus staging profile.
484     #
485     # Optional parameters:
486     #     :gerrit_verify_triggers: Override Gerrit Triggers.
487     #     :mvn-global-settings: The name of the Maven global settings to use for
488     #                           Maven configuration. (default: global-settings)
489     #     :cron: Cron schedule when to trigger the job. This parameter also
490     #         supports multiline input via YAML pipe | character in cases where
491     #         one may want to provide more than 1 cron timer. (default: '')
492
493     ######################
494     # Default parameters #
495     ######################
496
497     branch: master
498     build-days-to-keep: 30  # 30 days in case a release takes long to get approved.
499     build-timeout: 30
500     git-url: '$GIT_URL/$PROJECT'
501     java-version: openjdk8
502     mvn-global-settings: global-settings
503     mvn-opts: ''
504     mvn-params: ''
505     mvn-version: mvn33
506     stream: master
507     submodule-recursive: true
508     cron: ''
509
510     gerrit_release_triggers:
511       - comment-added-contains-event:
512           comment-contains-value: build release$
513
514     #####################
515     # Job Configuration #
516     #####################
517
518     builders:
519       - lf-jacoco-nojava-workaround
520       - lf-maven-install:
521           mvn-version: '{mvn-version}'
522       - lf-provide-maven-settings:
523           global-settings-file: '{mvn-global-settings}'
524           settings-file: '{mvn-settings}'
525       - lf-infra-create-netrc:
526           server-id: '{mvn-staging-id}'
527       - shell: !include-raw-escape:
528           - ../shell/lftools-install.sh
529           - ../shell/common-variables.sh
530           - ../shell/maven-patch-release.sh
531           - ../shell/maven-build.sh
532           - ../shell/maven-stage.sh
533       - lf-provide-maven-settings-cleanup
534
535 - job-template:
536     name: '{project-name}-maven-release-{stream}'
537     id: gerrit-maven-release
538     <<: *lf_maven_common
539     # yamllint disable-line rule:key-duplicates
540     <<: *lf_maven_release
541
542     scm:
543       - lf-infra-gerrit-scm:
544           jenkins-ssh-credential: '{jenkins-ssh-credential}'
545           git-url: '{git-url}'
546           refspec: '$GERRIT_REFSPEC'
547           branch: '$GERRIT_BRANCH'
548           submodule-recursive: '{submodule-recursive}'
549           choosing-strategy: default
550
551     triggers:
552       - timed: '{obj:cron}'
553       - gerrit:
554           server-name: '{gerrit-server-name}'
555           trigger-on: '{obj:gerrit_release_triggers}'
556           projects:
557             - project-compare-type: ANT
558               project-pattern: '{project}'
559               branches:
560                 - branch-compare-type: ANT
561                   branch-pattern: '**/{branch}'
562
563 - job-template:
564     name: '{project-name}-maven-release-{stream}'
565     id: github-maven-release
566     <<: *lf_maven_common
567     # yamllint disable-line rule:key-duplicates
568     <<: *lf_maven_release
569
570     properties:
571       - github:
572           url: '{git-url}/{github-org}/{project}'
573
574     scm:
575       - lf-infra-github-scm:
576           url: '{git-clone-url}{github-org}/{project}'
577           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
578           branch: '{branch}'
579           submodule-recursive: '{submodule-recursive}'
580           choosing-strategy: default
581           jenkins-ssh-credential: '{jenkins-ssh-credential}'
582
583     triggers:
584       - timed: '{obj:cron}'
585       - lf-infra-github-pr-trigger:
586           trigger-phrase: '^build release$'
587           only-trigger-phrase: true
588           status-context: 'Maven Release'
589           permit-all: true
590           github-hooks: true
591           github-org: ''
592           github_pr_whitelist:
593             - ''
594           github_pr_admin_list:
595             - ''
596
597 ###############
598 # Maven Sonar #
599 ###############
600
601 - lf_maven_sonar: &lf_maven_sonar
602     name: lf-maven-sonar
603
604     # Sonar job which runs mvn clean install then publishes to Sonar.
605     #
606     # This job purposely only runs on the master branch as there are Additional
607     # configuration needed to support multiple branches and there's not much
608     # interest in that kind of support.
609     #
610     # Required parameters:
611     #
612     #     :build-node: The node to run build on.
613     #     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
614     #         be configured in defaults.yaml)
615     #     :mvn-settings: The name of settings file containing credentials for
616     #         the project.
617     #
618     # Optional parameters:
619     #
620     #     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
621     #     :build-timeout: Timeout in seconds before aborting build. (default: 60)
622     #     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
623     #     :java-version: Version of Java to use for the build. (default: openjdk8)
624     #     :mvn-global-settings: The name of the Maven global settings to use for
625     #         Maven configuration. (default: global-settings)
626     #     :mvn-opts: Sets MAVEN_OPTS. (default: '')
627     #     :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
628     #     :mvn-version: Version of maven to use. (default: mvn33)
629     #     :submodule-recursive: Whether to checkout submodules recursively.
630     #         (default: true)
631     #
632     #     :gerrit_sonar_triggers: Override Gerrit Triggers.
633
634     ######################
635     # Default parameters #
636     ######################
637
638     branch: master  # Sonar should always be run on master branch
639     build-days-to-keep: 7
640     build-timeout: 30
641     git-url: '$GIT_URL/$PROJECT'
642     java-version: openjdk8
643     mvn-global-settings: global-settings
644     mvn-opts: ''
645     mvn-params: ''
646     mvn-version: mvn33
647     stream: master
648     submodule-recursive: true
649
650     gerrit_sonar_triggers:
651       - comment-added-contains-event:
652           comment-contains-value: run-sonar$
653
654     # Staging repos do not make sense for CLM jobs so set it blank.
655     staging-profile-id: ''
656
657     #####################
658     # Job Configuration #
659     #####################
660
661     triggers:
662       - timed: 'H H * * 6'
663       - gerrit:
664           server-name: '{gerrit-server-name}'
665           trigger-on: '{obj:gerrit_sonar_triggers}'
666           projects:
667             - project-compare-type: 'ANT'
668               project-pattern: '{project}'
669               branches:
670                 - branch-compare-type: 'ANT'
671                   branch-pattern: '**/master'
672           skip-vote:
673             successful: true
674             failed: true
675             unstable: true
676             notbuilt: true
677
678     builders:
679       - lf-infra-maven-sonar:
680           mvn-settings: '{mvn-settings}'
681           mvn-version: '{mvn-version}'
682
683     publishers:
684       - lf-jacoco-report
685       - findbugs
686       - lf-infra-publish
687
688 - builder:
689     name: lf-infra-maven-sonar
690     # Run a Sonar build with Maven
691     builders:
692       - lf-maven-install:
693           mvn-version: '{mvn-version}'
694       - inject:
695           # Switch this to the sonar wrapper when JJB 2.0 is available
696           properties-content: |
697               SONAR_HOST_URL=$SONAR_URL
698               SONAR_MAVEN_GOAL=sonar:sonar
699       - lf-provide-maven-settings:
700           global-settings-file: global-settings
701           settings-file: '{mvn-settings}'
702       - shell: !include-raw-escape:
703           - ../shell/common-variables.sh
704           - ../shell/maven-sonar.sh
705       - lf-provide-maven-settings-cleanup
706
707 - job-template:
708     name: '{project-name}-sonar'
709     id: gerrit-maven-sonar
710     <<: *lf_maven_common
711     # yamllint disable-line rule:key-duplicates
712     <<: *lf_maven_sonar
713
714     scm:
715       - lf-infra-gerrit-scm:
716           jenkins-ssh-credential: '{jenkins-ssh-credential}'
717           git-url: '{git-url}'
718           refspec: $GERRIT_REFSPEC
719           branch: $GERRIT_BRANCH
720           submodule-recursive: '{submodule-recursive}'
721           choosing-strategy: default
722
723 - job-template:
724     name: '{project-name}-sonar'
725     id: github-maven-sonar
726     <<: *lf_maven_common
727     # yamllint disable-line rule:key-duplicates
728     <<: *lf_maven_sonar
729
730     properties:
731       - github:
732           url: '{git-url}/{github-org}/{project}'
733
734     scm:
735       - lf-infra-github-scm:
736           url: '{git-clone-url}{github-org}/{project}'
737           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
738           branch: '{branch}'
739           submodule-recursive: '{submodule-recursive}'
740           choosing-strategy: default
741           jenkins-ssh-credential: '{jenkins-ssh-credential}'
742
743     triggers:
744       - lf-infra-github-pr-trigger:
745           trigger-phrase: '^recheck$'
746           only-trigger-phrase: false
747           status-context: 'Maven Verify'
748           permit-all: true
749           github-hooks: true
750           github-org: ''
751           github_pr_whitelist:
752             - ''
753           github_pr_admin_list:
754             - ''
755
756 ################
757 # Maven Verify #
758 ################
759
760 - lf_maven_verify: &lf_maven_verify
761     name: lf-maven-verify
762
763     # Verify job which runs mvn clean install to test a project build..
764     #
765     # Required parameters:
766     #
767     #     :build-node: The node to run build on.
768     #     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
769     #         be configured in defaults.yaml)
770     #     :mvn-settings: The name of settings file containing credentials for
771     #         the project.
772     #
773     # Optional parameters:
774     #
775     #     :branch: Git branch to fetch for the build. (default: master)
776     #     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
777     #     :build-timeout: Timeout in seconds before aborting build. (default: 60)
778     #     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
779     #     :java-version: Version of Java to use for the build. (default: openjdk8)
780     #     :mvn-global-settings: The name of the Maven global settings to use for
781     #         Maven configuration. (default: global-settings)
782     #     :mvn-opts: Sets MAVEN_OPTS. (default: '')
783     #     :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
784     #     :mvn-version: Version of maven to use. (default: mvn33)
785     #     :stream: Keyword that can be used to represent a release code-name.
786     #         Often the same as the branch. (default: master)
787     #     :submodule-recursive: Whether to checkout submodules recursively.
788     #         (default: true)
789     #
790     #     :gerrit_verify_triggers: Override Gerrit Triggers.
791     #     :gerrit_trigger_file_paths: Override file paths which can be used to
792     #         filter which file modifications will trigger a build.
793
794     ######################
795     # Default parameters #
796     ######################
797
798     branch: master
799     build-days-to-keep: 7
800     build-timeout: 60
801     git-url: '$GIT_URL/$PROJECT'
802     java-version: openjdk8
803     mvn-global-settings: global-settings
804     mvn-opts: ''
805     mvn-params: '-Dstream=$STREAM'
806     mvn-version: mvn33
807     stream: master
808     submodule-recursive: true
809
810     gerrit_verify_triggers:
811       - patchset-created-event:
812           exclude-drafts: false
813           exclude-trivial-rebase: false
814           exclude-no-code-change: false
815       - draft-published-event
816       - comment-added-contains-event:
817           comment-contains-value: recheck$
818     gerrit_trigger_file_paths:
819       - compare-type: ANT
820         pattern: '**'
821
822     #####################
823     # Job Configuration #
824     #####################
825
826     concurrent: true
827
828     builders:
829       - lf-jacoco-nojava-workaround
830       - lf-maven-install:
831           mvn-version: '{mvn-version}'
832       - lf-provide-maven-settings:
833           global-settings-file: '{mvn-global-settings}'
834           settings-file: '{mvn-settings}'
835       - shell: !include-raw-escape:
836           - ../shell/lftools-install.sh
837           - ../shell/common-variables.sh
838           - ../shell/maven-build.sh
839       - lf-provide-maven-settings-cleanup
840
841     publishers:
842       - findbugs
843       - lf-jacoco-report
844       - lf-infra-publish
845
846 - job-template:
847     name: '{project-name}-maven-verify-{stream}-{mvn-version}-{java-version}'
848     id: gerrit-maven-verify
849     <<: *lf_maven_common
850     # yamllint disable-line rule:key-duplicates
851     <<: *lf_maven_verify
852
853     scm:
854       - lf-infra-gerrit-scm:
855           jenkins-ssh-credential: '{jenkins-ssh-credential}'
856           git-url: '{git-url}'
857           refspec: '$GERRIT_REFSPEC'
858           branch: '$GERRIT_BRANCH'
859           submodule-recursive: '{submodule-recursive}'
860           choosing-strategy: gerrit
861
862     triggers:
863       - gerrit:
864           server-name: '{gerrit-server-name}'
865           trigger-on: '{obj:gerrit_verify_triggers}'
866           projects:
867             - project-compare-type: ANT
868               project-pattern: '{project}'
869               branches:
870                 - branch-compare-type: ANT
871                   branch-pattern: '**/{branch}'
872               file-paths: '{obj:gerrit_trigger_file_paths}'
873
874 - job-template:
875     name: '{project-name}-maven-verify-{stream}-{mvn-version}-{java-version}'
876     id: github-maven-verify
877     <<: *lf_maven_common
878     # yamllint disable-line rule:key-duplicates
879     <<: *lf_maven_verify
880
881     properties:
882       - github:
883           url: '{git-url}/{github-org}/{project}'
884
885     scm:
886       - lf-infra-github-scm:
887           url: '{git-clone-url}{github-org}/{project}'
888           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
889           branch: '{branch}'
890           submodule-recursive: '{submodule-recursive}'
891           choosing-strategy: default
892           jenkins-ssh-credential: '{jenkins-ssh-credential}'
893
894     triggers:
895       - lf-infra-github-pr-trigger:
896           trigger-phrase: '^recheck$'
897           only-trigger-phrase: false
898           status-context: 'Maven Verify'
899           permit-all: true
900           github-hooks: true
901           github-org: ''
902           github_pr_whitelist:
903             - ''
904           github_pr_admin_list:
905             - ''