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