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