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