Make staging-profile-id optional
[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     staging-profile-id: ''  # Unused in this job
120     stream: master
121     submodule-recursive: true
122
123     #####################
124     # Job Configuration #
125     #####################
126
127     triggers:
128       # Build weekly on Saturdays
129       - timed: 'H H * * 6'
130
131     builders:
132       - lf-maven-install:
133           mvn-version: '{mvn-version}'
134       - lf-provide-maven-settings:
135           global-settings-file: '{mvn-global-settings}'
136           settings-file: '{mvn-settings}'
137       - shell: !include-raw-escape:
138           - ../shell/common-variables.sh
139           - ../shell/sonatype-clm.sh
140       - lf-provide-maven-settings-cleanup
141       - shell: 'find . -regex ".*karaf/target" | xargs rm -rf'
142       - sonatype-clm:
143           application-name: '{project-name}'
144
145 - job-template:
146     name: '{project-name}-maven-clm-{stream}'
147     id: gerrit-maven-clm
148     <<: *lf_maven_common
149     # yamllint disable-line rule:key-duplicates
150     <<: *lf_maven_clm
151
152     scm:
153       - lf-infra-gerrit-scm:
154           jenkins-ssh-credential: '{jenkins-ssh-credential}'
155           git-url: '{git-url}'
156           refspec: '$GERRIT_REFSPEC'
157           branch: '$GERRIT_BRANCH'
158           submodule-recursive: '{submodule-recursive}'
159           choosing-strategy: default
160
161 - job-template:
162     name: '{project-name}-maven-clm-{stream}'
163     id: github-maven-clm
164     <<: *lf_maven_common
165     # yamllint disable-line rule:key-duplicates
166     <<: *lf_maven_clm
167
168     properties:
169       - github:
170           url: '{git-url}/{github-org}/{project}'
171
172     scm:
173       - lf-infra-github-scm:
174           url: '{git-clone-url}{github-org}/{project}'
175           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
176           branch: '{branch}'
177           submodule-recursive: '{submodule-recursive}'
178           choosing-strategy: default
179           jenkins-ssh-credential: '{jenkins-ssh-credential}'
180
181 #########################
182 # Maven Javadoc Publish #
183 #########################
184
185 - lf_maven_javadoc_publish: &lf_maven_javadoc_publish
186     name: lf-maven-javadoc-publish
187
188     # Produces and publishes javadocs for a Maven project.
189     #
190     # Expects javadocs to be available in $WORKSPACE/target/site/apidocs
191     #
192     # Required parameters:
193     #
194     #     :build-node: The node to run build on.
195     #     :javadoc-path: The path in Nexus to deploy javadoc to.
196     #     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
197     #                              be configured in defaults.yaml)
198     #     :mvn-settings: The name of settings file containing credentials for
199     #                    the project.
200     #     :mvn-site-id: Maven Server ID from settings.xml to pull credentials from.
201     #         (Note: This setting should be configured in defaults.yaml.)
202     #
203     # Optional parameters:
204     #
205     #     :branch: The branch to build against. (default: master)
206     #     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
207     #     :build-timeout: Timeout in seconds before aborting build. (default: 60)
208     #     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
209     #     :java-version: Version of Java to use for the build. (default: openjdk8)
210     #     :mvn-global-settings: The name of the Maven global settings to use for
211     #         Maven configuration. (default: global-settings)
212     #     :mvn-opts: Sets MAVEN_OPTS. (default: '')
213     #     :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
214     #     :mvn-version: Version of maven to use. (default: mvn33)
215     #     :submodule-recursive: Whether to checkout submodules recursively.
216     #         (default: true)
217     #
218     #     :gerrit_javadoc_merge_triggers: Override Gerrit Triggers.
219
220     ######################
221     # Default parameters #
222     ######################
223
224     branch: master
225     build-days-to-keep: 30  # 30 days in case a release takes long to get approved.
226     build-timeout: 30
227     git-url: '$GIT_URL/$PROJECT'
228     java-version: openjdk8
229     mvn-global-settings: global-settings
230     mvn-opts: ''
231     mvn-params: ''
232     mvn-version: mvn33
233     staging-profile-id: ''  # Unused by the javadoc jobs
234     stream: master
235     submodule-recursive: true
236
237     gerrit_javadoc_merge_triggers:
238       - change-merged-event
239       - comment-added-contains-event:
240           comment-contains-value: remerge$
241
242     #####################
243     # Job Configuration #
244     #####################
245
246     builders:
247       - lf-maven-install:
248           mvn-version: '{mvn-version}'
249       - lf-provide-maven-settings:
250           global-settings-file: '{mvn-global-settings}'
251           settings-file: '{mvn-settings}'
252       - lf-infra-create-netrc:
253           server-id: '{mvn-site-id}'
254       - inject:
255           properties-content: 'DEPLOY_PATH={javadoc-path}'
256       - shell: !include-raw-escape:
257           - ../shell/common-variables.sh
258           - ../shell/maven-javadoc-generate.sh
259           - ../shell/lftools-install.sh
260           - ../shell/maven-javadoc-publish.sh
261       - lf-provide-maven-settings-cleanup
262
263 - job-template:
264     name: '{project-name}-maven-javadoc-publish-{stream}'
265     id: gerrit-maven-javadoc-publish
266     <<: *lf_maven_common
267     # yamllint disable-line rule:key-duplicates
268     <<: *lf_maven_javadoc_publish
269
270     git-url: '$GIT_URL/$GERRIT_PROJECT'
271
272     scm:
273       - lf-infra-gerrit-scm:
274           git-url: '{git-url}'
275           refspec: ''
276           branch: '{branch}'
277           submodule-recursive: '{submodule-recursive}'
278           choosing-strategy: default
279           jenkins-ssh-credential: '{jenkins-ssh-credential}'
280
281     triggers:
282       - gerrit:
283           server-name: '{gerrit-server-name}'
284           trigger-on: '{obj:gerrit_javadoc_merge_triggers}'
285           projects:
286             - project-compare-type: ANT
287               project-pattern: '{project}'
288               branches:
289                 - branch-compare-type: ANT
290                   branch-pattern: '**/{branch}'
291
292 - job-template:
293     name: '{project-name}-maven-javadoc-publish-{stream}'
294     id: github-maven-javadoc-publish
295     <<: *lf_maven_common
296     # yamllint disable-line rule:key-duplicates
297     <<: *lf_maven_javadoc_publish
298
299     properties:
300       - github:
301           url: '{git-url}/{github-org}/{project}'
302
303     scm:
304       - lf-infra-github-scm:
305           url: '{git-clone-url}{github-org}/{project}'
306           refspec: ''
307           branch: '{branch}'
308           submodule-recursive: '{submodule-recursive}'
309           choosing-strategy: default
310           jenkins-ssh-credential: '{jenkins-ssh-credential}'
311
312     triggers:
313       - github
314       - pollscm:
315           cron: ''
316       - lf-infra-github-pr-trigger:
317           trigger-phrase: '^remerge$'
318           only-trigger-phrase: true
319           status-context: 'JJB Merge'
320           permit-all: false
321           github-hooks: true
322           github-org: '{github-org}'
323           github_pr_whitelist: '{obj:github_pr_whitelist}'
324           github_pr_admin_list: '{obj:github_pr_admin_list}'
325
326 ########################
327 # Maven Javadoc Verify #
328 ########################
329
330 - lf_maven_javadoc_verify: &lf_maven_javadoc_verify
331     name: lf-maven-javadoc-verify
332
333     # Produces javadocs for a Maven project.
334     #
335     # Expects javadocs to be available in $WORKSPACE/target/site/apidocs
336     #
337     # Required parameters:
338     #     build-node:    The node to run build on.
339     #     jenkins-ssh-credential: Credential to use for SSH. (Generally should
340     #                             be configured in defaults.yaml)
341     #     mvn-settings: The name of settings file containing credentials for
342     #                   the project.
343     #
344     # Optional parameters:
345     #
346     #     :branch: The branch to build against. (default: master)
347     #     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
348     #     :build-timeout: Timeout in seconds before aborting build. (default: 60)
349     #     :deploy-path:    The path in Nexus to deploy javadoc to. (default: $PROJECT/$STREAM)
350     #     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
351     #     :java-version: Version of Java to use for the build. (default: openjdk8)
352     #     :mvn-global-settings: The name of the Maven global settings to use for
353     #         Maven configuration. (default: global-settings)
354     #     :mvn-opts: Sets MAVEN_OPTS. (default: '')
355     #     :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
356     #     :mvn-version: Version of maven to use. (default: mvn33)
357     #     :submodule-recursive: Whether to checkout submodules recursively.
358     #         (default: true)
359     #
360     #     :gerrit_javadoc_verify_triggers: Override Gerrit Triggers.
361
362     ######################
363     # Default parameters #
364     ######################
365
366     branch: master
367     build-days-to-keep: 30  # 30 days in case a release takes long to get approved.
368     build-timeout: 30
369     git-url: '$GIT_URL/$PROJECT'
370     java-version: openjdk8
371     mvn-global-settings: global-settings
372     mvn-opts: ''
373     mvn-params: ''
374     mvn-version: mvn33
375     staging-profile-id: ''  # Unused by the javadoc jobs
376     stream: master
377     submodule-recursive: true
378
379     gerrit_javadoc_verify_triggers:
380       - patchset-created-event:
381           exclude-drafts: true
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     staging-profile-id: ''  # Unused in this job
648     stream: master
649     submodule-recursive: true
650
651     gerrit_sonar_triggers:
652       - comment-added-contains-event:
653           comment-contains-value: run-sonar$
654
655     #####################
656     # Job Configuration #
657     #####################
658
659     triggers:
660       - timed: 'H H * * 6'
661       - gerrit:
662           server-name: '{gerrit-server-name}'
663           trigger-on: '{obj:gerrit_sonar_triggers}'
664           projects:
665             - project-compare-type: 'ANT'
666               project-pattern: '{project}'
667               branches:
668                 - branch-compare-type: 'ANT'
669                   branch-pattern: '**/master'
670           skip-vote:
671             successful: true
672             failed: true
673             unstable: true
674             notbuilt: true
675
676     builders:
677       - lf-infra-maven-sonar:
678           mvn-settings: '{mvn-settings}'
679           mvn-version: '{mvn-version}'
680
681     publishers:
682       - lf-jacoco-report
683       - findbugs
684       - lf-infra-publish
685
686 - builder:
687     name: lf-infra-maven-sonar
688     # Run a Sonar build with Maven
689     builders:
690       - lf-maven-install:
691           mvn-version: '{mvn-version}'
692       - inject:
693           # Switch this to the sonar wrapper when JJB 2.0 is available
694           properties-content: |
695               SONAR_HOST_URL=$SONAR_URL
696               SONAR_MAVEN_GOAL=sonar:sonar
697       - lf-provide-maven-settings:
698           global-settings-file: global-settings
699           settings-file: '{mvn-settings}'
700       - shell: !include-raw-escape:
701           - ../shell/common-variables.sh
702           - ../shell/maven-sonar.sh
703       - lf-provide-maven-settings-cleanup
704
705 - job-template:
706     name: '{project-name}-sonar'
707     id: gerrit-maven-sonar
708     <<: *lf_maven_common
709     # yamllint disable-line rule:key-duplicates
710     <<: *lf_maven_sonar
711
712     scm:
713       - lf-infra-gerrit-scm:
714           jenkins-ssh-credential: '{jenkins-ssh-credential}'
715           git-url: '{git-url}'
716           refspec: $GERRIT_REFSPEC
717           branch: $GERRIT_BRANCH
718           submodule-recursive: '{submodule-recursive}'
719           choosing-strategy: default
720
721 - job-template:
722     name: '{project-name}-sonar'
723     id: github-maven-sonar
724     <<: *lf_maven_common
725     # yamllint disable-line rule:key-duplicates
726     <<: *lf_maven_sonar
727
728     properties:
729       - github:
730           url: '{git-url}/{github-org}/{project}'
731
732     scm:
733       - lf-infra-github-scm:
734           url: '{git-clone-url}{github-org}/{project}'
735           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
736           branch: '{branch}'
737           submodule-recursive: '{submodule-recursive}'
738           choosing-strategy: default
739           jenkins-ssh-credential: '{jenkins-ssh-credential}'
740
741     triggers:
742       - lf-infra-github-pr-trigger:
743           trigger-phrase: '^recheck$'
744           only-trigger-phrase: false
745           status-context: 'Maven Verify'
746           permit-all: true
747           github-hooks: true
748           github-org: ''
749           github_pr_whitelist:
750             - ''
751           github_pr_admin_list:
752             - ''
753
754 ################
755 # Maven Verify #
756 ################
757
758 - lf_maven_verify: &lf_maven_verify
759     name: lf-maven-verify
760
761     # Verify job which runs mvn clean install to test a project build..
762     #
763     # Required parameters:
764     #
765     #     :build-node: The node to run build on.
766     #     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
767     #         be configured in defaults.yaml)
768     #     :mvn-settings: The name of settings file containing credentials for
769     #         the project.
770     #
771     # Optional parameters:
772     #
773     #     :branch: Git branch to fetch for the build. (default: master)
774     #     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
775     #     :build-timeout: Timeout in seconds before aborting build. (default: 60)
776     #     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
777     #     :java-version: Version of Java to use for the build. (default: openjdk8)
778     #     :mvn-global-settings: The name of the Maven global settings to use for
779     #         Maven configuration. (default: global-settings)
780     #     :mvn-opts: Sets MAVEN_OPTS. (default: '')
781     #     :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
782     #     :mvn-version: Version of maven to use. (default: mvn33)
783     #     :stream: Keyword that can be used to represent a release code-name.
784     #         Often the same as the branch. (default: master)
785     #     :submodule-recursive: Whether to checkout submodules recursively.
786     #         (default: true)
787     #
788     #     :gerrit_verify_triggers: Override Gerrit Triggers.
789     #     :gerrit_trigger_file_paths: Override file paths which can be used to
790     #         filter which file modifications will trigger a build.
791
792     ######################
793     # Default parameters #
794     ######################
795
796     branch: master
797     build-days-to-keep: 7
798     build-timeout: 60
799     git-url: '$GIT_URL/$PROJECT'
800     java-version: openjdk8
801     mvn-global-settings: global-settings
802     mvn-opts: ''
803     mvn-params: '-Dstream=$STREAM'
804     mvn-version: mvn33
805     staging-profile-id: ''  # Unused in this job
806     stream: master
807     submodule-recursive: true
808
809     gerrit_verify_triggers:
810       - patchset-created-event:
811           exclude-drafts: true
812           exclude-trivial-rebase: false
813           exclude-no-code-change: false
814       - draft-published-event
815       - comment-added-contains-event:
816           comment-contains-value: recheck$
817     gerrit_trigger_file_paths:
818       - compare-type: ANT
819         pattern: '**'
820
821     #####################
822     # Job Configuration #
823     #####################
824
825     concurrent: true
826
827     builders:
828       - lf-jacoco-nojava-workaround
829       - lf-maven-install:
830           mvn-version: '{mvn-version}'
831       - lf-provide-maven-settings:
832           global-settings-file: '{mvn-global-settings}'
833           settings-file: '{mvn-settings}'
834       - shell: !include-raw-escape:
835           - ../shell/lftools-install.sh
836           - ../shell/common-variables.sh
837           - ../shell/maven-build.sh
838       - lf-provide-maven-settings-cleanup
839
840     publishers:
841       - findbugs
842       - lf-jacoco-report
843       - lf-infra-publish
844
845 - job-template:
846     name: '{project-name}-maven-verify-{stream}-{mvn-version}-{java-version}'
847     id: gerrit-maven-verify
848     <<: *lf_maven_common
849     # yamllint disable-line rule:key-duplicates
850     <<: *lf_maven_verify
851
852     scm:
853       - lf-infra-gerrit-scm:
854           jenkins-ssh-credential: '{jenkins-ssh-credential}'
855           git-url: '{git-url}'
856           refspec: '$GERRIT_REFSPEC'
857           branch: '$GERRIT_BRANCH'
858           submodule-recursive: '{submodule-recursive}'
859           choosing-strategy: gerrit
860
861     triggers:
862       - gerrit:
863           server-name: '{gerrit-server-name}'
864           trigger-on: '{obj:gerrit_verify_triggers}'
865           projects:
866             - project-compare-type: ANT
867               project-pattern: '{project}'
868               branches:
869                 - branch-compare-type: ANT
870                   branch-pattern: '**/{branch}'
871               file-paths: '{obj:gerrit_trigger_file_paths}'
872
873 - job-template:
874     name: '{project-name}-maven-verify-{stream}-{mvn-version}-{java-version}'
875     id: github-maven-verify
876     <<: *lf_maven_common
877     # yamllint disable-line rule:key-duplicates
878     <<: *lf_maven_verify
879
880     properties:
881       - github:
882           url: '{git-url}/{github-org}/{project}'
883
884     scm:
885       - lf-infra-github-scm:
886           url: '{git-clone-url}{github-org}/{project}'
887           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
888           branch: '{branch}'
889           submodule-recursive: '{submodule-recursive}'
890           choosing-strategy: default
891           jenkins-ssh-credential: '{jenkins-ssh-credential}'
892
893     triggers:
894       - lf-infra-github-pr-trigger:
895           trigger-phrase: '^recheck$'
896           only-trigger-phrase: false
897           status-context: 'Maven Verify'
898           permit-all: true
899           github-hooks: true
900           github-org: ''
901           github_pr_whitelist:
902             - ''
903           github_pr_admin_list:
904             - ''