Fix github-maven-merge scm config
[releng/global-jjb.git] / jjb / lf-maven-jobs.yaml
1 ---
2 # This file contains job templates for Maven projects.
3
4 ##########
5 # Macros #
6 ##########
7
8 - builder:
9     name: lf-maven-build
10     builders:
11       - inject:
12           properties-content: 'MAVEN_GOALS={mvn-goals}'
13       - shell: !include-raw-escape:
14           - ../shell/common-variables.sh
15           - ../shell/maven-build.sh
16
17 - builder:
18     name: lf-maven-deploy
19     builders:
20       - shell: !include-raw:
21           - ../shell/common-variables.sh
22           - ../shell/maven-deploy.sh
23
24 - builder:
25     name: lf-maven-stage
26     builders:
27       # include-raw-escape fails due to JJB bug
28       - shell: !include-raw:
29           - ../shell/common-variables.sh
30           - ../shell/maven-stage.sh
31
32 - builder:
33     name: lf-update-java-alternatives
34     builders:
35       - inject:
36           # Work around inject plugin overriding our GIT_URL variable incorrectly
37           # https://issues.jenkins-ci.org/browse/JENKINS-49775
38           properties-content: |
39             SET_JDK_VERSION={java-version}
40             GIT_URL="$GIT_URL"
41       - shell: !include-raw-escape: ../shell/update-java-alternatives.sh
42       - inject:
43           properties-file: '/tmp/java.env'
44
45 ####################
46 # COMMON FUNCTIONS #
47 ####################
48
49 - lf_maven_common: &lf_maven_common
50     name: lf-maven-common
51
52     ######################
53     # Default parameters #
54     ######################
55
56     archive-artifacts: >
57       **/*.log
58       **/hs_err_*.log
59       **/target/**/feature.xml
60       **/target/failsafe-reports/failsafe-summary.xml
61       **/target/surefire-reports/*-output.txt
62
63     #####################
64     # Job Configuration #
65     #####################
66
67     project-type: freestyle
68     node: '{build-node}'
69
70     properties:
71       - lf-infra-properties:
72           build-days-to-keep: '{build-days-to-keep}'
73
74     parameters:
75       - lf-infra-parameters:
76           project: '{project}'
77           branch: '{branch}'
78           stream: '{stream}'
79           lftools-version: '{lftools-version}'
80       - lf-infra-maven-parameters:
81           mvn-opts: '{mvn-opts}'
82           mvn-params: '{mvn-params}'
83           mvn-version: '{mvn-version}'
84       - string:
85           name: ARCHIVE_ARTIFACTS
86           default: '{archive-artifacts}'
87           description: Artifacts to archive to the logs server.
88
89     wrappers:
90       - lf-infra-wrappers:
91           build-timeout: '{build-timeout}'
92           jenkins-ssh-credential: '{jenkins-ssh-credential}'
93
94     publishers:
95       # TODO: Make email notification work.
96       # - lf-infra-email-notify:
97       #     email-recipients: '{email-recipients}'
98       #     email-prefix: '[releng]'
99       - lf-infra-publish
100
101 #############
102 # Maven CLM #
103 #############
104
105 - lf_maven_clm: &lf_maven_clm
106     name: lf-maven-clm
107
108     ######################
109     # Default parameters #
110     ######################
111
112     branch: master
113     build-days-to-keep: 30  # 30 days for troubleshooting purposes
114     build-timeout: 60
115     disable-job: false
116     git-url: '$GIT_URL/$PROJECT'
117     github-url: 'https://github.com'
118     java-version: openjdk8
119     mvn-global-settings: global-settings
120     mvn-opts: ''
121     mvn-params: ''
122     mvn-version: mvn35
123     nexus-iq-stage: 'build'
124     stream: master
125     submodule-recursive: true
126
127     nexus_iq_scan_patterns:
128       - '**/*.ear'
129       - '**/*.jar'
130       - '**/*.tar.gz'
131       - '**/*.war'
132       - '**/*.zip'
133
134     gerrit_clm_triggers:
135       - comment-added-contains-event:
136           comment-contains-value: run-clm$
137
138     parameters:
139       - lf-infra-parameters:
140           project: '{project}'
141           branch: '{branch}'
142           stream: '{stream}'
143           lftools-version: '{lftools-version}'
144       - lf-infra-maven-parameters:
145           mvn-opts: '{mvn-opts}'
146           mvn-params: '{mvn-params}'
147           mvn-version: '{mvn-version}'
148       - string:
149           name: ARCHIVE_ARTIFACTS
150           default: '{archive-artifacts}'
151           description: Artifacts to archive to the logs server.
152       - lf-clm-parameters:
153           nexus-iq-stage: '{nexus-iq-stage}'
154
155     #####################
156     # Job Configuration #
157     #####################
158
159     disabled: '{disable-job}'
160
161     builders:
162       - lf-infra-pre-build
163       - lf-maven-install:
164           mvn-version: '{mvn-version}'
165       - lf-update-java-alternatives:
166           java-version: '{java-version}'
167       - lf-provide-maven-settings:
168           global-settings-file: '{mvn-global-settings}'
169           settings-file: '{mvn-settings}'
170       - shell: !include-raw-escape:
171           - ../shell/common-variables.sh
172           - ../shell/sonatype-clm.sh
173       - lf-provide-maven-settings-cleanup
174       - shell: 'find . -regex ".*karaf/target" | xargs rm -rf'
175       - nexus-iq-policy-evaluator:
176           stage: '{nexus-iq-stage}'
177           application-type: 'manual'
178           application-id: '{project-name}'
179           scan-patterns: '{obj:nexus_iq_scan_patterns}'
180           fail-build-network-error: true
181
182 - job-template:
183     name: '{project-name}-maven-clm-{stream}'
184     id: gerrit-maven-clm
185     <<: *lf_maven_common
186     # yamllint disable-line rule:key-duplicates
187     <<: *lf_maven_clm
188
189     scm:
190       - lf-infra-gerrit-scm:
191           jenkins-ssh-credential: '{jenkins-ssh-credential}'
192           git-url: '{git-url}'
193           refspec: '$GERRIT_REFSPEC'
194           branch: '$GERRIT_BRANCH'
195           submodule-recursive: '{submodule-recursive}'
196           choosing-strategy: default
197
198     triggers:
199       # Build weekly on Saturdays
200       - timed: 'H H * * 6'
201       - gerrit:
202           server-name: '{gerrit-server-name}'
203           trigger-on: '{obj:gerrit_clm_triggers}'
204           projects:
205             - project-compare-type: ANT
206               project-pattern: '{project}'
207               branches:
208                 - branch-compare-type: ANT
209                   branch-pattern: '**/{branch}'
210           skip-vote:
211             successful: true
212             failed: true
213             unstable: true
214             notbuilt: true
215
216 - job-template:
217     name: '{project-name}-maven-clm-{stream}'
218     id: github-maven-clm
219     <<: *lf_maven_common
220     # yamllint disable-line rule:key-duplicates
221     <<: *lf_maven_clm
222
223     properties:
224       - lf-infra-properties:
225           build-days-to-keep: '{build-days-to-keep}'
226       - github:
227           url: '{github-url}/{github-org}/{project}'
228
229     scm:
230       - lf-infra-github-scm:
231           url: '{git-clone-url}{github-org}/{project}'
232           refspec: ''
233           branch: 'refs/heads/{branch}'
234           submodule-recursive: '{submodule-recursive}'
235           choosing-strategy: default
236           jenkins-ssh-credential: '{jenkins-ssh-credential}'
237
238     triggers:
239       # Build weekly on Saturdays
240       - timed: 'H H * * 6'
241       - github-pull-request:
242           trigger-phrase: '^run-clm$'
243           only-trigger-phrase: true
244           status-context: 'CLM'
245           permit-all: true
246           github-hooks: true
247           org-list:
248             - '{github-org}'
249           white-list: '{obj:github_pr_whitelist}'
250           admin-list: '{obj:github_pr_admin_list}'
251           white-list-target-branches:
252             - '{branch}'
253
254 #########################
255 # Maven Javadoc Publish #
256 #########################
257
258 - lf_maven_javadoc_publish: &lf_maven_javadoc_publish
259     name: lf-maven-javadoc-publish
260
261     ######################
262     # Default parameters #
263     ######################
264
265     branch: master
266     build-days-to-keep: 30  # 30 days in case a release takes long to get approved.
267     build-timeout: 60
268     disable-job: false
269     git-url: '$GIT_URL/$PROJECT'
270     github-url: 'https://github.com'
271     java-version: openjdk8
272     mvn-global-settings: global-settings
273     mvn-opts: ''
274     mvn-params: ''
275     mvn-version: mvn35
276     stream: master
277     submodule-recursive: true
278
279     gerrit_merge_triggers:
280       - change-merged-event
281       - comment-added-contains-event:
282           comment-contains-value: remerge$
283
284     #####################
285     # Job Configuration #
286     #####################
287
288     disabled: '{disable-job}'
289
290     builders:
291       - lf-infra-pre-build
292       - lf-maven-install:
293           mvn-version: '{mvn-version}'
294       - lf-update-java-alternatives:
295           java-version: '{java-version}'
296       - lf-provide-maven-settings:
297           global-settings-file: '{mvn-global-settings}'
298           settings-file: '{mvn-settings}'
299       - lf-infra-create-netrc:
300           server-id: '{mvn-site-id}'
301       - inject:
302           properties-content: 'DEPLOY_PATH={javadoc-path}'
303       - shell: !include-raw-escape:
304           - ../shell/common-variables.sh
305           - ../shell/maven-javadoc-generate.sh
306           - ../shell/maven-javadoc-publish.sh
307       - lf-provide-maven-settings-cleanup
308
309 - job-template:
310     name: '{project-name}-maven-javadoc-publish-{stream}'
311     id: gerrit-maven-javadoc-publish
312     <<: *lf_maven_common
313     # yamllint disable-line rule:key-duplicates
314     <<: *lf_maven_javadoc_publish
315
316     git-url: '$GIT_URL/$GERRIT_PROJECT'
317
318     scm:
319       - lf-infra-gerrit-scm:
320           git-url: '{git-url}'
321           refspec: ''
322           branch: '{branch}'
323           submodule-recursive: '{submodule-recursive}'
324           choosing-strategy: default
325           jenkins-ssh-credential: '{jenkins-ssh-credential}'
326
327     triggers:
328       - gerrit:
329           server-name: '{gerrit-server-name}'
330           trigger-on: '{obj:gerrit_merge_triggers}'
331           projects:
332             - project-compare-type: ANT
333               project-pattern: '{project}'
334               branches:
335                 - branch-compare-type: ANT
336                   branch-pattern: '**/{branch}'
337
338 - job-template:
339     name: '{project-name}-maven-javadoc-publish-{stream}'
340     id: github-maven-javadoc-publish
341     <<: *lf_maven_common
342     # yamllint disable-line rule:key-duplicates
343     <<: *lf_maven_javadoc_publish
344
345     properties:
346       - lf-infra-properties:
347           build-days-to-keep: '{build-days-to-keep}'
348       - github:
349           url: '{github-url}/{github-org}/{project}'
350
351     scm:
352       - lf-infra-github-scm:
353           url: '{git-clone-url}{github-org}/{project}'
354           refspec: ''
355           branch: '{branch}'
356           submodule-recursive: '{submodule-recursive}'
357           choosing-strategy: default
358           jenkins-ssh-credential: '{jenkins-ssh-credential}'
359
360     triggers:
361       - github
362       - pollscm:
363           cron: ''
364       - github-pull-request:
365           trigger-phrase: '^remerge$'
366           only-trigger-phrase: true
367           status-context: 'Maven Javadoc Publish'
368           permit-all: true
369           github-hooks: true
370           org-list:
371             - '{github-org}'
372           white-list: '{obj:github_pr_whitelist}'
373           admin-list: '{obj:github_pr_admin_list}'
374           white-list-target-branches:
375             - '{branch}'
376
377 ########################
378 # Maven Javadoc Verify #
379 ########################
380
381 - lf_maven_javadoc_verify: &lf_maven_javadoc_verify
382     name: lf-maven-javadoc-verify
383
384     ######################
385     # Default parameters #
386     ######################
387
388     branch: master
389     build-days-to-keep: 30  # 30 days in case a release takes long to get approved.
390     build-timeout: 60
391     disable-job: false
392     git-url: '$GIT_URL/$PROJECT'
393     github-url: 'https://github.com'
394     java-version: openjdk8
395     mvn-global-settings: global-settings
396     mvn-opts: ''
397     mvn-params: ''
398     mvn-version: mvn35
399     stream: master
400     submodule-recursive: true
401
402     gerrit_verify_triggers:
403       - patchset-created-event:
404           exclude-drafts: true
405           exclude-trivial-rebase: false
406           exclude-no-code-change: false
407       - draft-published-event
408       - comment-added-contains-event:
409           comment-contains-value: '^Patch Set[ ]+[0-9]+:([ ]+|[\n]+)(recheck|reverify)$'
410
411     #####################
412     # Job Configuration #
413     #####################
414
415     concurrent: true
416     disabled: '{disable-job}'
417
418     builders:
419       - lf-infra-pre-build
420       - lf-maven-install:
421           mvn-version: '{mvn-version}'
422       - lf-update-java-alternatives:
423           java-version: '{java-version}'
424       - lf-provide-maven-settings:
425           global-settings-file: '{mvn-global-settings}'
426           settings-file: '{mvn-settings}'
427       - shell: !include-raw-escape:
428           - ../shell/common-variables.sh
429           - ../shell/maven-javadoc-generate.sh
430       - lf-provide-maven-settings-cleanup
431
432 - job-template:
433     name: '{project-name}-maven-javadoc-verify-{stream}'
434     id: gerrit-maven-javadoc-verify
435     <<: *lf_maven_common
436     # yamllint disable-line rule:key-duplicates
437     <<: *lf_maven_javadoc_verify
438
439     scm:
440       - lf-infra-gerrit-scm:
441           jenkins-ssh-credential: '{jenkins-ssh-credential}'
442           git-url: '{git-url}'
443           refspec: '$GERRIT_REFSPEC'
444           branch: '$GERRIT_BRANCH'
445           submodule-recursive: '{submodule-recursive}'
446           choosing-strategy: gerrit
447
448     triggers:
449       - gerrit:
450           server-name: '{gerrit-server-name}'
451           trigger-on: '{obj:gerrit_verify_triggers}'
452           projects:
453             - project-compare-type: ANT
454               project-pattern: '{project}'
455               branches:
456                 - branch-compare-type: ANT
457                   branch-pattern: '**/{branch}'
458
459 - job-template:
460     name: '{project-name}-maven-javadoc-verify-{stream}'
461     id: github-maven-javadoc-verify
462     <<: *lf_maven_common
463     # yamllint disable-line rule:key-duplicates
464     <<: *lf_maven_javadoc_verify
465
466     properties:
467       - lf-infra-properties:
468           build-days-to-keep: '{build-days-to-keep}'
469       - github:
470           url: '{github-url}/{github-org}/{project}'
471
472     scm:
473       - lf-infra-github-scm:
474           url: '{git-clone-url}{github-org}/{project}'
475           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
476           branch: '$sha1'
477           submodule-recursive: '{submodule-recursive}'
478           choosing-strategy: default
479           jenkins-ssh-credential: '{jenkins-ssh-credential}'
480
481     triggers:
482       - github-pull-request:
483           trigger-phrase: ^(recheck|reverify)$
484           only-trigger-phrase: false
485           status-context: 'Maven Javadoc Verify'
486           permit-all: true
487           github-hooks: true
488           white-list-target-branches:
489             - '{branch}'
490
491 ###############
492 # Maven Merge #
493 ###############
494
495 - lf_maven_merge: &lf_maven_merge
496     name: lf-maven-merge
497
498     ######################
499     # Default parameters #
500     ######################
501
502     branch: master
503     build-days-to-keep: 30  # 30 days in case we need to troubleshoot
504     build-timeout: 60
505     cron: '@daily'
506     disable-job: false
507     git-url: '$GIT_URL/$PROJECT'
508     github-url: 'https://github.com'
509     java-version: openjdk8
510     mvn-global-settings: global-settings
511     mvn-goals: clean deploy
512     mvn-opts: ''
513     mvn-params: '-Dmerge'
514     mvn-version: mvn35
515     nexus-cut-dirs: 6  # Number of dirs in the Nexus path to remove for wget -r.
516     stream: master
517     submodule-recursive: true
518
519     gerrit_merge_triggers:
520       - change-merged-event
521       - comment-added-contains-event:
522           comment-contains-value: remerge$
523
524     gerrit_trigger_file_paths:
525       - compare-type: REG_EXP
526         pattern: '.*'
527
528     # github_included_regions MUST match gerrit_trigger_file_paths
529     github_included_regions:
530       - '.*'
531
532     post_build_trigger: ''
533
534     #####################
535     # Job Configuration #
536     #####################
537
538     disabled: '{disable-job}'
539
540     builders:
541       - lf-infra-pre-build
542       - lf-jacoco-nojava-workaround
543       - lf-maven-install:
544           mvn-version: '{mvn-version}'
545       - lf-update-java-alternatives:
546           java-version: '{java-version}'
547       - lf-provide-maven-settings:
548           global-settings-file: '{mvn-global-settings}'
549           settings-file: '{mvn-settings}'
550       - lf-infra-create-netrc:
551           server-id: '{mvn-snapshot-id}'
552       - inject:
553           properties-content: |
554               NEXUS_CUT_DIRS={nexus-cut-dirs}
555               NEXUS_REPO={nexus-snapshot-repo}
556       - shell: !include-raw-escape: ../shell/maven-fetch-metadata.sh
557       - lf-maven-build:
558           mvn-goals: '{mvn-goals}'
559       - lf-maven-deploy
560       - lf-provide-maven-settings-cleanup
561
562     publishers:
563       - findbugs
564       - lf-jacoco-report
565       - lf-infra-publish
566       - trigger-parameterized-builds: '{obj:post_build_trigger}'
567
568 - job-template:
569     name: '{project-name}-maven-merge-{stream}'
570     id: gerrit-maven-merge
571     <<: *lf_maven_common
572     # yamllint disable-line rule:key-duplicates
573     <<: *lf_maven_merge
574
575     scm:
576       - lf-infra-gerrit-scm:
577           jenkins-ssh-credential: '{jenkins-ssh-credential}'
578           git-url: '{git-url}'
579           refspec: '$GERRIT_REFSPEC'
580           branch: '$GERRIT_BRANCH'
581           submodule-recursive: '{submodule-recursive}'
582           choosing-strategy: default
583
584     triggers:
585       - timed: '{obj:cron}'
586       - gerrit:
587           server-name: '{gerrit-server-name}'
588           trigger-on: '{obj:gerrit_merge_triggers}'
589           projects:
590             - project-compare-type: ANT
591               project-pattern: '{project}'
592               branches:
593                 - branch-compare-type: ANT
594                   branch-pattern: '**/{branch}'
595               file-paths: '{obj:gerrit_trigger_file_paths}'
596
597 - job-template:
598     name: '{project-name}-maven-merge-{stream}'
599     id: github-maven-merge
600     <<: *lf_maven_common
601     # yamllint disable-line rule:key-duplicates
602     <<: *lf_maven_merge
603
604     properties:
605       - lf-infra-properties:
606           build-days-to-keep: '{build-days-to-keep}'
607       - github:
608           url: '{github-url}/{github-org}/{project}'
609
610     scm:
611       - lf-infra-github-scm:
612           url: '{git-clone-url}{github-org}/{project}'
613           refspec: ''
614           branch: 'refs/heads/{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       - github
622       - pollscm:
623           cron: ''
624       - github-pull-request:
625           trigger-phrase: '^remerge$'
626           only-trigger-phrase: true
627           status-context: 'Maven Merge'
628           permit-all: true
629           github-hooks: true
630           org-list:
631             - '{github-org}'
632           white-list: '{obj:github_pr_whitelist}'
633           admin-list: '{obj:github_pr_admin_list}'
634           white-list-target-branches:
635             - '{branch}'
636           included-regions: '{obj:github_included_regions}'
637
638 ###############
639 # Maven Stage #
640 ###############
641
642 - lf_maven_stage: &lf_maven_stage
643     name: lf-maven-stage
644
645     ######################
646     # Default parameters #
647     ######################
648
649     branch: master
650     build-days-to-keep: 30  # 30 days in case a release takes long to get approved.
651     build-timeout: 60
652     cron: '@daily'
653     disable-job: false
654     git-url: '$GIT_URL/$PROJECT'
655     github-url: 'https://github.com'
656     java-version: openjdk8
657     mvn-global-settings: global-settings
658     mvn-goals: clean deploy
659     mvn-opts: ''
660     mvn-params: ''
661     mvn-version: mvn35
662     sign-artifacts: false
663     stream: master
664     submodule-recursive: true
665
666     gerrit_release_triggers:
667       - comment-added-contains-event:
668           comment-contains-value: stage-release$
669
670     #####################
671     # Job Configuration #
672     #####################
673
674     disabled: '{disable-job}'
675
676     parameters:
677       - lf-infra-parameters:
678           project: '{project}'
679           branch: '{branch}'
680           stream: '{stream}'
681           lftools-version: '{lftools-version}'
682       - lf-infra-maven-parameters:
683           mvn-opts: '{mvn-opts}'
684           mvn-params: '{mvn-params}'
685           mvn-version: '{mvn-version}'
686           staging-profile-id: '{staging-profile-id}'
687       - string:
688           name: ARCHIVE_ARTIFACTS
689           default: '{archive-artifacts}'
690           description: Artifacts to archive to the logs server.
691       - string:
692           name: STAGING_PROFILE_ID
693           default: '{staging-profile-id}'
694           description: Nexus staging profile ID.
695
696     builders:
697       - lf-infra-pre-build
698       - lf-jacoco-nojava-workaround
699       - lf-maven-install:
700           mvn-version: '{mvn-version}'
701       - lf-update-java-alternatives:
702           java-version: '{java-version}'
703       - lf-provide-maven-settings:
704           global-settings-file: '{mvn-global-settings}'
705           settings-file: '{mvn-settings}'
706       - lf-infra-create-netrc:
707           server-id: '{mvn-staging-id}'
708       - shell: !include-raw-escape: ../shell/maven-patch-release.sh
709       - lf-maven-build:
710           mvn-goals: '{mvn-goals}'
711       - lf-sigul-sign-dir:
712           sign-artifacts: '{sign-artifacts}'
713           sign-dir: '$WORKSPACE/m2repo'
714       - lf-maven-stage
715       - lf-provide-maven-settings-cleanup
716
717 - job-template:
718     name: '{project-name}-maven-stage-{stream}'
719     id: gerrit-maven-stage
720     <<: *lf_maven_common
721     # yamllint disable-line rule:key-duplicates
722     <<: *lf_maven_stage
723
724     scm:
725       - lf-infra-gerrit-scm:
726           jenkins-ssh-credential: '{jenkins-ssh-credential}'
727           git-url: '{git-url}'
728           refspec: '$GERRIT_REFSPEC'
729           branch: '$GERRIT_BRANCH'
730           submodule-recursive: '{submodule-recursive}'
731           choosing-strategy: default
732
733     triggers:
734       - timed: '{obj:cron}'
735       - gerrit:
736           server-name: '{gerrit-server-name}'
737           trigger-on: '{obj:gerrit_release_triggers}'
738           projects:
739             - project-compare-type: ANT
740               project-pattern: '{project}'
741               branches:
742                 - branch-compare-type: ANT
743                   branch-pattern: '**/{branch}'
744
745 - job-template:
746     name: '{project-name}-maven-stage-{stream}'
747     id: github-maven-stage
748     <<: *lf_maven_common
749     # yamllint disable-line rule:key-duplicates
750     <<: *lf_maven_stage
751
752     properties:
753       - lf-infra-properties:
754           build-days-to-keep: '{build-days-to-keep}'
755       - github:
756           url: '{github-url}/{github-org}/{project}'
757
758     scm:
759       - lf-infra-github-scm:
760           url: '{git-clone-url}{github-org}/{project}'
761           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
762           branch: '{branch}'
763           submodule-recursive: '{submodule-recursive}'
764           choosing-strategy: default
765           jenkins-ssh-credential: '{jenkins-ssh-credential}'
766
767     triggers:
768       - timed: '{obj:cron}'
769       - github-pull-request:
770           trigger-phrase: '^build release$'
771           only-trigger-phrase: true
772           status-context: 'Maven Release'
773           permit-all: true
774           github-hooks: true
775           white-list-target-branches:
776             - '{branch}'
777
778 ###############
779 # Maven Sonar #
780 ###############
781
782 - lf_maven_sonar: &lf_maven_sonar
783     name: lf-maven-sonar
784
785     ######################
786     # Default parameters #
787     ######################
788
789     branch: master  # Sonar should always be run on master branch
790     build-days-to-keep: 7
791     build-timeout: 60
792     cron: 'H H * * 6'  # run weekly
793     disable-job: false
794     git-url: '$GIT_URL/$PROJECT'
795     github-url: 'https://github.com'
796     java-version: openjdk8
797     mvn-global-settings: global-settings
798     mvn-opts: ''
799     mvn-params: ''
800     mvn-version: mvn35
801     sonar-mvn-goal: 'sonar:sonar'
802     stream: master
803     submodule-recursive: true
804
805     gerrit_sonar_triggers:
806       - comment-added-contains-event:
807           comment-contains-value: run-sonar$
808
809     #####################
810     # Job Configuration #
811     #####################
812
813     disabled: '{disable-job}'
814
815     parameters:
816       - lf-infra-parameters:
817           project: '{project}'
818           branch: '{branch}'
819           stream: '{stream}'
820           lftools-version: '{lftools-version}'
821       - lf-infra-maven-parameters:
822           mvn-opts: '{mvn-opts}'
823           mvn-params: '{mvn-params}'
824           mvn-version: '{mvn-version}'
825       - string:
826           name: ARCHIVE_ARTIFACTS
827           default: '{archive-artifacts}'
828           description: Artifacts to archive to the logs server.
829       - string:
830           name: SONAR_MAVEN_GOAL
831           default: '{sonar-mvn-goal}'
832           description: |
833               Maven goals to pass to the Sonar call. Typically sonar:sonar
834               however to use a specific version of the sonar-maven-plugin we
835               can call "org.codehaus.mojo:sonar-maven-plugin:3.3.0.603:sonar".
836
837     triggers:
838       - timed: '{obj:cron}'
839       - gerrit:
840           server-name: '{gerrit-server-name}'
841           trigger-on: '{obj:gerrit_sonar_triggers}'
842           projects:
843             - project-compare-type: 'ANT'
844               project-pattern: '{project}'
845               branches:
846                 - branch-compare-type: 'ANT'
847                   branch-pattern: '**/master'
848           skip-vote:
849             successful: true
850             failed: true
851             unstable: true
852             notbuilt: true
853
854     builders:
855       - lf-infra-pre-build
856       - lf-infra-maven-sonar:
857           java-version: '{java-version}'
858           mvn-settings: '{mvn-settings}'
859           mvn-version: '{mvn-version}'
860
861     publishers:
862       - lf-jacoco-report
863       - findbugs
864       - lf-infra-publish
865
866 - builder:
867     name: lf-infra-maven-sonar
868     # Run a Sonar build with Maven
869     builders:
870       - lf-maven-install:
871           mvn-version: '{mvn-version}'
872       - lf-update-java-alternatives:
873           java-version: '{java-version}'
874       - inject:
875           # Switch this to the sonar wrapper when JJB 2.0 is available
876           properties-content: SONAR_HOST_URL=$SONAR_URL
877       - lf-provide-maven-settings:
878           global-settings-file: global-settings
879           settings-file: '{mvn-settings}'
880       - shell: !include-raw-escape:
881           - ../shell/common-variables.sh
882           - ../shell/maven-sonar.sh
883       - lf-provide-maven-settings-cleanup
884
885 - job-template:
886     name: '{project-name}-sonar'
887     id: gerrit-maven-sonar
888     <<: *lf_maven_common
889     # yamllint disable-line rule:key-duplicates
890     <<: *lf_maven_sonar
891
892     scm:
893       - lf-infra-gerrit-scm:
894           jenkins-ssh-credential: '{jenkins-ssh-credential}'
895           git-url: '{git-url}'
896           refspec: $GERRIT_REFSPEC
897           branch: $GERRIT_BRANCH
898           submodule-recursive: '{submodule-recursive}'
899           choosing-strategy: default
900
901 - job-template:
902     name: '{project-name}-sonar'
903     id: github-maven-sonar
904     <<: *lf_maven_common
905     # yamllint disable-line rule:key-duplicates
906     <<: *lf_maven_sonar
907
908     properties:
909       - lf-infra-properties:
910           build-days-to-keep: '{build-days-to-keep}'
911       - github:
912           url: '{github-url}/{github-org}/{project}'
913
914     scm:
915       - lf-infra-github-scm:
916           url: '{git-clone-url}{github-org}/{project}'
917           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
918           branch: '$sha1'
919           submodule-recursive: '{submodule-recursive}'
920           choosing-strategy: default
921           jenkins-ssh-credential: '{jenkins-ssh-credential}'
922
923     triggers:
924       - github-pull-request:
925           trigger-phrase: '^run-sonar$'
926           only-trigger-phrase: false
927           status-context: 'Maven Sonar'
928           permit-all: true
929           github-hooks: true
930           white-list-target-branches:
931             - '{branch}'
932
933 ################
934 # Maven Verify #
935 ################
936
937 - lf_maven_verify: &lf_maven_verify
938     name: lf-maven-verify
939
940     ######################
941     # Default parameters #
942     ######################
943
944     branch: master
945     build-days-to-keep: 7
946     build-timeout: 60
947     disable-job: false
948     git-url: '$GIT_URL/$PROJECT'
949     github-url: 'https://github.com'
950     java-version: openjdk8
951     mvn-global-settings: global-settings
952     mvn-goals: clean deploy
953     mvn-opts: ''
954     mvn-params: '-Dstream=$STREAM'
955     mvn-version: mvn35
956     stream: master
957     submodule-recursive: true
958
959     gerrit_verify_triggers:
960       - patchset-created-event:
961           exclude-drafts: true
962           exclude-trivial-rebase: false
963           exclude-no-code-change: false
964       - draft-published-event
965       - comment-added-contains-event:
966           comment-contains-value: '^Patch Set[ ]+[0-9]+:([ ]+|[\n]+)(recheck|reverify)$'
967
968     gerrit_trigger_file_paths:
969       - compare-type: REG_EXP
970         pattern: '.*'
971
972     # github_included_regions MUST match gerrit_trigger_file_paths
973     github_included_regions:
974       - '.*'
975
976     #####################
977     # Job Configuration #
978     #####################
979
980     concurrent: true
981     disabled: '{disable-job}'
982
983     builders:
984       - lf-infra-pre-build
985       - lf-jacoco-nojava-workaround
986       - lf-maven-install:
987           mvn-version: '{mvn-version}'
988       - lf-update-java-alternatives:
989           java-version: '{java-version}'
990       - lf-provide-maven-settings:
991           global-settings-file: '{mvn-global-settings}'
992           settings-file: '{mvn-settings}'
993       - lf-maven-build:
994           mvn-goals: '{mvn-goals}'
995       - lf-provide-maven-settings-cleanup
996
997     publishers:
998       - findbugs
999       - lf-jacoco-report
1000       - lf-infra-publish
1001
1002 - job-template:
1003     name: '{project-name}-maven-verify-{stream}-{mvn-version}-{java-version}'
1004     id: gerrit-maven-verify
1005     <<: *lf_maven_common
1006     # yamllint disable-line rule:key-duplicates
1007     <<: *lf_maven_verify
1008
1009     scm:
1010       - lf-infra-gerrit-scm:
1011           jenkins-ssh-credential: '{jenkins-ssh-credential}'
1012           git-url: '{git-url}'
1013           refspec: '$GERRIT_REFSPEC'
1014           branch: '$GERRIT_BRANCH'
1015           submodule-recursive: '{submodule-recursive}'
1016           choosing-strategy: gerrit
1017
1018     triggers:
1019       - gerrit:
1020           server-name: '{gerrit-server-name}'
1021           trigger-on: '{obj:gerrit_verify_triggers}'
1022           projects:
1023             - project-compare-type: ANT
1024               project-pattern: '{project}'
1025               branches:
1026                 - branch-compare-type: ANT
1027                   branch-pattern: '**/{branch}'
1028               file-paths: '{obj:gerrit_trigger_file_paths}'
1029
1030 - job-template:
1031     name: '{project-name}-maven-verify-{stream}-{mvn-version}-{java-version}'
1032     id: github-maven-verify
1033     <<: *lf_maven_common
1034     # yamllint disable-line rule:key-duplicates
1035     <<: *lf_maven_verify
1036
1037     properties:
1038       - lf-infra-properties:
1039           build-days-to-keep: '{build-days-to-keep}'
1040       - github:
1041           url: '{github-url}/{github-org}/{project}'
1042
1043     scm:
1044       - lf-infra-github-scm:
1045           url: '{git-clone-url}{github-org}/{project}'
1046           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
1047           branch: '$sha1'
1048           submodule-recursive: '{submodule-recursive}'
1049           choosing-strategy: default
1050           jenkins-ssh-credential: '{jenkins-ssh-credential}'
1051
1052     triggers:
1053       - github-pull-request:
1054           trigger-phrase: '^(recheck|reverify)$'
1055           only-trigger-phrase: false
1056           status-context: 'Maven Verify'
1057           permit-all: true
1058           github-hooks: true
1059           white-list-target-branches:
1060             - '{branch}'
1061           included-regions: '{obj:github_included_regions}'
1062
1063 #############################
1064 # Maven Verify Dependencies #
1065 #############################
1066
1067 - lf_maven_verify_dependencies: &lf_maven_verify_dependencies
1068     name: lf-maven-verify-dependencies
1069
1070     ######################
1071     # Default parameters #
1072     ######################
1073
1074     branch: master
1075     build-days-to-keep: 7
1076     build-timeout: 60
1077     disable-job: false
1078     git-url: '$GIT_URL/$PROJECT'
1079     github-url: 'https://github.com'
1080     java-version: openjdk8
1081     mvn-global-settings: global-settings
1082     mvn-goals: clean deploy
1083     mvn-opts: ''
1084     mvn-params: '-Dstream=$STREAM'
1085     mvn-version: mvn35
1086     stream: master
1087     submodule-recursive: true
1088
1089     gerrit_verify_triggers:
1090       - comment-added-contains-event:
1091           comment-contains-value: 'recheck: [0-9 ]+'
1092     gerrit_trigger_file_paths:
1093       - compare-type: ANT
1094         pattern: '**'
1095
1096     #####################
1097     # Job Configuration #
1098     #####################
1099
1100     concurrent: true
1101     disabled: '{disable-job}'
1102
1103     builders:
1104       - lf-infra-pre-build
1105       - lf-jacoco-nojava-workaround
1106       - lf-maven-install:
1107           mvn-version: '{mvn-version}'
1108       - lf-update-java-alternatives:
1109           java-version: '{java-version}'
1110       - lf-provide-maven-settings:
1111           global-settings-file: '{mvn-global-settings}'
1112           settings-file: '{mvn-settings}'
1113       - lf-fetch-dependent-patches
1114       - shell: !include-raw-escape:
1115           - ../shell/common-variables.sh
1116           - ../shell/maven-build-deps.sh
1117       - lf-maven-build:
1118           mvn-goals: '{mvn-goals}'
1119       - lf-provide-maven-settings-cleanup
1120
1121     publishers:
1122       - findbugs
1123       - lf-jacoco-report
1124       - lf-infra-publish
1125
1126 - job-template:
1127     name: '{project-name}-maven-verify-deps-{stream}-{mvn-version}-{java-version}'
1128     id: gerrit-maven-verify-dependencies
1129     <<: *lf_maven_common
1130     # yamllint disable-line rule:key-duplicates
1131     <<: *lf_maven_verify_dependencies
1132
1133     scm:
1134       - lf-infra-gerrit-scm:
1135           jenkins-ssh-credential: '{jenkins-ssh-credential}'
1136           git-url: '{git-url}'
1137           refspec: '$GERRIT_REFSPEC'
1138           branch: '$GERRIT_BRANCH'
1139           submodule-recursive: '{submodule-recursive}'
1140           choosing-strategy: gerrit
1141
1142     triggers:
1143       - gerrit:
1144           server-name: '{gerrit-server-name}'
1145           trigger-on: '{obj:gerrit_verify_triggers}'
1146           projects:
1147             - project-compare-type: ANT
1148               project-pattern: '{project}'
1149               branches:
1150                 - branch-compare-type: ANT
1151                   branch-pattern: '**/{branch}'
1152               file-paths: '{obj:gerrit_trigger_file_paths}'