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