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