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