Add maven-javadoc jobs
[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     #     staging-profile-id: Profile ID of the project's Nexus staging profile.
482     #
483     # Optional parameters:
484     #     :gerrit_verify_triggers: Override Gerrit Triggers.
485     #     :mvn-global-settings: The name of the Maven global settings to use for
486     #                           Maven configuration. (default: global-settings)
487
488     ######################
489     # Default parameters #
490     ######################
491
492     branch: master
493     build-days-to-keep: 30  # 30 days in case a release takes long to get approved.
494     build-timeout: 30
495     git-url: '$GIT_URL/$PROJECT'
496     java-version: openjdk8
497     mvn-global-settings: global-settings
498     mvn-opts: ''
499     mvn-params: ''
500     mvn-version: mvn33
501     stream: master
502     submodule-recursive: true
503
504     gerrit_release_triggers:
505       - comment-added-contains-event:
506           comment-contains-value: build release$
507
508     #####################
509     # Job Configuration #
510     #####################
511
512     builders:
513       - lf-jacoco-nojava-workaround
514       - lf-maven-install:
515           mvn-version: '{mvn-version}'
516       - lf-provide-maven-settings:
517           global-settings-file: '{mvn-global-settings}'
518           settings-file: '{mvn-settings}'
519       - lf-infra-create-netrc:
520           server-id: opendaylight-staging
521       - shell: !include-raw-escape:
522           - ../shell/lftools-install.sh
523           - ../shell/common-variables.sh
524           - ../shell/maven-patch-release.sh
525           - ../shell/maven-build.sh
526           - ../shell/maven-stage.sh
527       - lf-provide-maven-settings-cleanup
528
529 - job-template:
530     name: '{project-name}-maven-release-{stream}'
531     id: gerrit-maven-release
532     <<: *lf_maven_common
533     # yamllint disable-line rule:key-duplicates
534     <<: *lf_maven_release
535
536     scm:
537       - lf-infra-gerrit-scm:
538           jenkins-ssh-credential: '{jenkins-ssh-credential}'
539           git-url: '{git-url}'
540           refspec: '$GERRIT_REFSPEC'
541           branch: '$GERRIT_BRANCH'
542           submodule-recursive: '{submodule-recursive}'
543           choosing-strategy: default
544
545     triggers:
546       - gerrit:
547           server-name: '{gerrit-server-name}'
548           trigger-on: '{obj:gerrit_release_triggers}'
549           projects:
550             - project-compare-type: ANT
551               project-pattern: '{project}'
552               branches:
553                 - branch-compare-type: ANT
554                   branch-pattern: '**/{branch}'
555
556 - job-template:
557     name: '{project-name}-maven-release-{stream}'
558     id: github-maven-release
559     <<: *lf_maven_common
560     # yamllint disable-line rule:key-duplicates
561     <<: *lf_maven_release
562
563     properties:
564       - github:
565           url: '{git-url}/{github-org}/{project}'
566
567     scm:
568       - lf-infra-github-scm:
569           url: '{git-clone-url}{github-org}/{project}'
570           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
571           branch: '{branch}'
572           submodule-recursive: '{submodule-recursive}'
573           choosing-strategy: default
574           jenkins-ssh-credential: '{jenkins-ssh-credential}'
575
576     triggers:
577       - lf-infra-github-pr-trigger:
578           trigger-phrase: '^build release$'
579           only-trigger-phrase: true
580           status-context: 'Maven Release'
581           permit-all: true
582           github-hooks: true
583           github-org: ''
584           github_pr_whitelist:
585             - ''
586           github_pr_admin_list:
587             - ''
588
589 ###############
590 # Maven Sonar #
591 ###############
592
593 - lf_maven_sonar: &lf_maven_sonar
594     name: lf-maven-sonar
595
596     # Sonar job which runs mvn clean install then publishes to Sonar.
597     #
598     # This job purposely only runs on the master branch as there are Additional
599     # configuration needed to support multiple branches and there's not much
600     # interest in that kind of support.
601     #
602     # Required parameters:
603     #
604     #     :build-node: The node to run build on.
605     #     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
606     #         be configured in defaults.yaml)
607     #     :mvn-settings: The name of settings file containing credentials for
608     #         the project.
609     #
610     # Optional parameters:
611     #
612     #     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
613     #     :build-timeout: Timeout in seconds before aborting build. (default: 60)
614     #     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
615     #     :java-version: Version of Java to use for the build. (default: openjdk8)
616     #     :mvn-global-settings: The name of the Maven global settings to use for
617     #         Maven configuration. (default: global-settings)
618     #     :mvn-opts: Sets MAVEN_OPTS. (default: '')
619     #     :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
620     #     :mvn-version: Version of maven to use. (default: mvn33)
621     #     :submodule-recursive: Whether to checkout submodules recursively.
622     #         (default: true)
623     #
624     #     :gerrit_sonar_triggers: Override Gerrit Triggers.
625
626     ######################
627     # Default parameters #
628     ######################
629
630     branch: master  # Sonar should always be run on master branch
631     build-days-to-keep: 7
632     build-timeout: 30
633     git-url: '$GIT_URL/$PROJECT'
634     java-version: openjdk8
635     mvn-global-settings: global-settings
636     mvn-opts: ''
637     mvn-params: ''
638     mvn-version: mvn33
639     stream: master
640     submodule-recursive: true
641
642     gerrit_sonar_triggers:
643       - comment-added-contains-event:
644           comment-contains-value: run-sonar$
645
646     # Staging repos do not make sense for CLM jobs so set it blank.
647     staging-profile-id: ''
648
649     #####################
650     # Job Configuration #
651     #####################
652
653     triggers:
654       - timed: 'H H * * 6'
655       - gerrit:
656           server-name: '{gerrit-server-name}'
657           trigger-on: '{obj:gerrit_sonar_triggers}'
658           projects:
659             - project-compare-type: 'ANT'
660               project-pattern: '{project}'
661               branches:
662                 - branch-compare-type: 'ANT'
663                   branch-pattern: '**/master'
664           skip-vote:
665             successful: true
666             failed: true
667             unstable: true
668             notbuilt: true
669
670     builders:
671       - lf-infra-maven-sonar:
672           mvn-settings: '{mvn-settings}'
673           mvn-version: '{mvn-version}'
674
675     publishers:
676       - lf-jacoco-report
677       - findbugs
678       - lf-infra-publish
679
680 - builder:
681     name: lf-infra-maven-sonar
682     # Run a Sonar build with Maven
683     builders:
684       - lf-maven-install:
685           mvn-version: '{mvn-version}'
686       - inject:
687           # Switch this to the sonar wrapper when JJB 2.0 is available
688           properties-content: |
689               SONAR_HOST_URL=$SONAR_URL
690               SONAR_MAVEN_GOAL=sonar:sonar
691       - lf-provide-maven-settings:
692           global-settings-file: global-settings
693           settings-file: '{mvn-settings}'
694       - shell: !include-raw-escape:
695           - ../shell/common-variables.sh
696           - ../shell/maven-sonar.sh
697       - lf-provide-maven-settings-cleanup
698
699 - job-template:
700     name: '{project-name}-sonar'
701     id: gerrit-maven-sonar
702     <<: *lf_maven_common
703     # yamllint disable-line rule:key-duplicates
704     <<: *lf_maven_sonar
705
706     scm:
707       - lf-infra-gerrit-scm:
708           jenkins-ssh-credential: '{jenkins-ssh-credential}'
709           git-url: '{git-url}'
710           refspec: $GERRIT_REFSPEC
711           branch: $GERRIT_BRANCH
712           submodule-recursive: '{submodule-recursive}'
713           choosing-strategy: default
714
715 - job-template:
716     name: '{project-name}-sonar'
717     id: github-maven-sonar
718     <<: *lf_maven_common
719     # yamllint disable-line rule:key-duplicates
720     <<: *lf_maven_sonar
721
722     properties:
723       - github:
724           url: '{git-url}/{github-org}/{project}'
725
726     scm:
727       - lf-infra-github-scm:
728           url: '{git-clone-url}{github-org}/{project}'
729           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
730           branch: '{branch}'
731           submodule-recursive: '{submodule-recursive}'
732           choosing-strategy: default
733           jenkins-ssh-credential: '{jenkins-ssh-credential}'
734
735     triggers:
736       - lf-infra-github-pr-trigger:
737           trigger-phrase: '^recheck$'
738           only-trigger-phrase: false
739           status-context: 'Maven Verify'
740           permit-all: true
741           github-hooks: true
742           github-org: ''
743           github_pr_whitelist:
744             - ''
745           github_pr_admin_list:
746             - ''
747
748 ################
749 # Maven Verify #
750 ################
751
752 - lf_maven_verify: &lf_maven_verify
753     name: lf-maven-verify
754
755     # Verify job which runs mvn clean install to test a project build..
756     #
757     # Required parameters:
758     #
759     #     :build-node: The node to run build on.
760     #     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
761     #         be configured in defaults.yaml)
762     #     :mvn-settings: The name of settings file containing credentials for
763     #         the project.
764     #
765     # Optional parameters:
766     #
767     #     :branch: Git branch to fetch for the build. (default: master)
768     #     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
769     #     :build-timeout: Timeout in seconds before aborting build. (default: 60)
770     #     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
771     #     :java-version: Version of Java to use for the build. (default: openjdk8)
772     #     :mvn-global-settings: The name of the Maven global settings to use for
773     #         Maven configuration. (default: global-settings)
774     #     :mvn-opts: Sets MAVEN_OPTS. (default: '')
775     #     :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
776     #     :mvn-version: Version of maven to use. (default: mvn33)
777     #     :stream: Keyword that can be used to represent a release code-name.
778     #         Often the same as the branch. (default: master)
779     #     :submodule-recursive: Whether to checkout submodules recursively.
780     #         (default: true)
781     #
782     #     :gerrit_verify_triggers: Override Gerrit Triggers.
783     #     :gerrit_trigger_file_paths: Override file paths which can be used to
784     #         filter which file modifications will trigger a build.
785
786     ######################
787     # Default parameters #
788     ######################
789
790     branch: master
791     build-days-to-keep: 7
792     build-timeout: 60
793     git-url: '$GIT_URL/$PROJECT'
794     java-version: openjdk8
795     mvn-global-settings: global-settings
796     mvn-opts: ''
797     mvn-params: '-Dstream=$STREAM'
798     mvn-version: mvn33
799     stream: master
800     submodule-recursive: true
801
802     gerrit_verify_triggers:
803       - patchset-created-event:
804           exclude-drafts: false
805           exclude-trivial-rebase: false
806           exclude-no-code-change: false
807       - draft-published-event
808       - comment-added-contains-event:
809           comment-contains-value: recheck$
810     gerrit_trigger_file_paths:
811       - compare-type: ANT
812         pattern: '**'
813
814     #####################
815     # Job Configuration #
816     #####################
817
818     concurrent: true
819
820     builders:
821       - lf-jacoco-nojava-workaround
822       - lf-maven-install:
823           mvn-version: '{mvn-version}'
824       - lf-provide-maven-settings:
825           global-settings-file: '{mvn-global-settings}'
826           settings-file: '{mvn-settings}'
827       - shell: !include-raw-escape:
828           - ../shell/lftools-install.sh
829           - ../shell/common-variables.sh
830           - ../shell/maven-build.sh
831       - lf-provide-maven-settings-cleanup
832
833     publishers:
834       - findbugs
835       - lf-jacoco-report
836       - lf-infra-publish
837
838 - job-template:
839     name: '{project-name}-maven-verify-{stream}-{mvn-version}-{java-version}'
840     id: gerrit-maven-verify
841     <<: *lf_maven_common
842     # yamllint disable-line rule:key-duplicates
843     <<: *lf_maven_verify
844
845     scm:
846       - lf-infra-gerrit-scm:
847           jenkins-ssh-credential: '{jenkins-ssh-credential}'
848           git-url: '{git-url}'
849           refspec: '$GERRIT_REFSPEC'
850           branch: '$GERRIT_BRANCH'
851           submodule-recursive: '{submodule-recursive}'
852           choosing-strategy: gerrit
853
854     triggers:
855       - gerrit:
856           server-name: '{gerrit-server-name}'
857           trigger-on: '{obj:gerrit_verify_triggers}'
858           projects:
859             - project-compare-type: ANT
860               project-pattern: '{project}'
861               branches:
862                 - branch-compare-type: ANT
863                   branch-pattern: '**/{branch}'
864               file-paths: '{obj:gerrit_trigger_file_paths}'
865
866 - job-template:
867     name: '{project-name}-maven-verify-{stream}-{mvn-version}-{java-version}'
868     id: github-maven-verify
869     <<: *lf_maven_common
870     # yamllint disable-line rule:key-duplicates
871     <<: *lf_maven_verify
872
873     properties:
874       - github:
875           url: '{git-url}/{github-org}/{project}'
876
877     scm:
878       - lf-infra-github-scm:
879           url: '{git-clone-url}{github-org}/{project}'
880           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
881           branch: '{branch}'
882           submodule-recursive: '{submodule-recursive}'
883           choosing-strategy: default
884           jenkins-ssh-credential: '{jenkins-ssh-credential}'
885
886     triggers:
887       - lf-infra-github-pr-trigger:
888           trigger-phrase: '^recheck$'
889           only-trigger-phrase: false
890           status-context: 'Maven Verify'
891           permit-all: true
892           github-hooks: true
893           github-org: ''
894           github_pr_whitelist:
895             - ''
896           github_pr_admin_list:
897             - ''