2 # This file contains job templates for Maven projects.
5 name: '{project-name}-maven-jobs'
7 # This job group contains all the recommended jobs that should be deployed
12 - gerrit-maven-release
16 name: '{project-name}-github-maven-jobs'
18 # This job group contains all the recommended jobs that should be deployed
19 # for any project ci that is using github.
23 - github-maven-release
27 name: '{project-name}-maven-javadoc-jobs'
29 # This job group contains all the recommended jobs that should be deployed
33 - gerrit-maven-javadoc-publish
34 - gerrit-maven-javadoc-verify
37 name: '{project-name}-github-maven-javadoc-jobs'
39 # This job group contains all the recommended jobs that should be deployed
43 - github-maven-javadoc-publish
44 - github-maven-javadoc-verify
50 - lf_maven_common: &lf_maven_common
53 project-type: freestyle
58 - lf-infra-properties:
59 build-days-to-keep: '{build-days-to-keep}'
62 - lf-infra-parameters:
66 lftools-version: '{lftools-version}'
67 - lf-infra-maven-parameters:
68 mvn-opts: '{mvn-opts}'
69 mvn-params: '{mvn-params}'
70 mvn-version: '{mvn-version}'
71 # Staging repos do not make sense for CLM jobs so set it blank.
72 staging-profile-id: '{staging-profile-id}'
76 build-timeout: '{build-timeout}'
77 jenkins-ssh-credential: '{jenkins-ssh-credential}'
80 # TODO: Make email notification work.
81 # - lf-infra-email-notify:
82 # email-recipients: '{email-recipients}'
83 # email-prefix: '[releng]'
90 - lf_maven_clm: &lf_maven_clm
93 # Produces a CLM scan of the code into Nexus IQ Server.
95 # Required parameters:
96 # build-node: The node to run build on.
97 # jenkins-ssh-credential: Credential to use for SSH. (Generally should
98 # be configured in defaults.yaml)
99 # mvn-settings: The name of settings file containing credentials for
102 # Optional parameters:
103 # mvn-global-settings: The name of the Maven global settings to use for
104 # Maven configuration. (default: global-settings)
106 ######################
107 # Default parameters #
108 ######################
111 build-days-to-keep: 30 # 30 days for troubleshooting purposes
113 git-url: '$GIT_URL/$PROJECT'
114 java-version: openjdk8
115 mvn-global-settings: global-settings
119 staging-profile-id: '' # Unused in this job
121 submodule-recursive: true
123 #####################
124 # Job Configuration #
125 #####################
128 # Build weekly on Saturdays
133 mvn-version: '{mvn-version}'
134 - lf-provide-maven-settings:
135 global-settings-file: '{mvn-global-settings}'
136 settings-file: '{mvn-settings}'
137 - shell: !include-raw-escape:
138 - ../shell/common-variables.sh
139 - ../shell/sonatype-clm.sh
140 - lf-provide-maven-settings-cleanup
141 - shell: 'find . -regex ".*karaf/target" | xargs rm -rf'
143 application-name: '{project-name}'
146 name: '{project-name}-maven-clm-{stream}'
149 # yamllint disable-line rule:key-duplicates
153 - lf-infra-gerrit-scm:
154 jenkins-ssh-credential: '{jenkins-ssh-credential}'
156 refspec: '$GERRIT_REFSPEC'
157 branch: '$GERRIT_BRANCH'
158 submodule-recursive: '{submodule-recursive}'
159 choosing-strategy: default
162 name: '{project-name}-maven-clm-{stream}'
165 # yamllint disable-line rule:key-duplicates
170 url: '{git-url}/{github-org}/{project}'
173 - lf-infra-github-scm:
174 url: '{git-clone-url}{github-org}/{project}'
175 refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
177 submodule-recursive: '{submodule-recursive}'
178 choosing-strategy: default
179 jenkins-ssh-credential: '{jenkins-ssh-credential}'
181 #########################
182 # Maven Javadoc Publish #
183 #########################
185 - lf_maven_javadoc_publish: &lf_maven_javadoc_publish
186 name: lf-maven-javadoc-publish
188 # Produces and publishes javadocs for a Maven project.
190 # Expects javadocs to be available in $WORKSPACE/target/site/apidocs
192 # Required parameters:
194 # :build-node: The node to run build on.
195 # :javadoc-path: The path in Nexus to deploy javadoc to.
196 # :jenkins-ssh-credential: Credential to use for SSH. (Generally should
197 # be configured in defaults.yaml)
198 # :mvn-settings: The name of settings file containing credentials for
200 # :mvn-site-id: Maven Server ID from settings.xml to pull credentials from.
201 # (Note: This setting should be configured in defaults.yaml.)
203 # Optional parameters:
205 # :branch: The branch to build against. (default: master)
206 # :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
207 # :build-timeout: Timeout in seconds before aborting build. (default: 60)
208 # :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
209 # :java-version: Version of Java to use for the build. (default: openjdk8)
210 # :mvn-global-settings: The name of the Maven global settings to use for
211 # Maven configuration. (default: global-settings)
212 # :mvn-opts: Sets MAVEN_OPTS. (default: '')
213 # :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
214 # :mvn-version: Version of maven to use. (default: mvn33)
215 # :submodule-recursive: Whether to checkout submodules recursively.
218 # :gerrit_javadoc_merge_triggers: Override Gerrit Triggers.
220 ######################
221 # Default parameters #
222 ######################
225 build-days-to-keep: 30 # 30 days in case a release takes long to get approved.
227 git-url: '$GIT_URL/$PROJECT'
228 java-version: openjdk8
229 mvn-global-settings: global-settings
233 staging-profile-id: '' # Unused by the javadoc jobs
235 submodule-recursive: true
237 gerrit_javadoc_merge_triggers:
238 - change-merged-event
239 - comment-added-contains-event:
240 comment-contains-value: remerge$
242 #####################
243 # Job Configuration #
244 #####################
248 mvn-version: '{mvn-version}'
249 - lf-provide-maven-settings:
250 global-settings-file: '{mvn-global-settings}'
251 settings-file: '{mvn-settings}'
252 - lf-infra-create-netrc:
253 server-id: '{mvn-site-id}'
255 properties-content: 'DEPLOY_PATH={javadoc-path}'
256 - shell: !include-raw-escape:
257 - ../shell/common-variables.sh
258 - ../shell/maven-javadoc-generate.sh
259 - ../shell/lftools-install.sh
260 - ../shell/maven-javadoc-publish.sh
261 - lf-provide-maven-settings-cleanup
264 name: '{project-name}-maven-javadoc-publish-{stream}'
265 id: gerrit-maven-javadoc-publish
267 # yamllint disable-line rule:key-duplicates
268 <<: *lf_maven_javadoc_publish
270 git-url: '$GIT_URL/$GERRIT_PROJECT'
273 - lf-infra-gerrit-scm:
277 submodule-recursive: '{submodule-recursive}'
278 choosing-strategy: default
279 jenkins-ssh-credential: '{jenkins-ssh-credential}'
283 server-name: '{gerrit-server-name}'
284 trigger-on: '{obj:gerrit_javadoc_merge_triggers}'
286 - project-compare-type: ANT
287 project-pattern: '{project}'
289 - branch-compare-type: ANT
290 branch-pattern: '**/{branch}'
293 name: '{project-name}-maven-javadoc-publish-{stream}'
294 id: github-maven-javadoc-publish
296 # yamllint disable-line rule:key-duplicates
297 <<: *lf_maven_javadoc_publish
301 url: '{git-url}/{github-org}/{project}'
304 - lf-infra-github-scm:
305 url: '{git-clone-url}{github-org}/{project}'
308 submodule-recursive: '{submodule-recursive}'
309 choosing-strategy: default
310 jenkins-ssh-credential: '{jenkins-ssh-credential}'
316 - lf-infra-github-pr-trigger:
317 trigger-phrase: '^remerge$'
318 only-trigger-phrase: true
319 status-context: 'JJB Merge'
322 github-org: '{github-org}'
323 github_pr_whitelist: '{obj:github_pr_whitelist}'
324 github_pr_admin_list: '{obj:github_pr_admin_list}'
326 ########################
327 # Maven Javadoc Verify #
328 ########################
330 - lf_maven_javadoc_verify: &lf_maven_javadoc_verify
331 name: lf-maven-javadoc-verify
333 # Produces javadocs for a Maven project.
335 # Expects javadocs to be available in $WORKSPACE/target/site/apidocs
337 # Required parameters:
338 # build-node: The node to run build on.
339 # jenkins-ssh-credential: Credential to use for SSH. (Generally should
340 # be configured in defaults.yaml)
341 # mvn-settings: The name of settings file containing credentials for
344 # Optional parameters:
346 # :branch: The branch to build against. (default: master)
347 # :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
348 # :build-timeout: Timeout in seconds before aborting build. (default: 60)
349 # :deploy-path: The path in Nexus to deploy javadoc to. (default: $PROJECT/$STREAM)
350 # :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
351 # :java-version: Version of Java to use for the build. (default: openjdk8)
352 # :mvn-global-settings: The name of the Maven global settings to use for
353 # Maven configuration. (default: global-settings)
354 # :mvn-opts: Sets MAVEN_OPTS. (default: '')
355 # :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
356 # :mvn-version: Version of maven to use. (default: mvn33)
357 # :submodule-recursive: Whether to checkout submodules recursively.
360 # :gerrit_javadoc_verify_triggers: Override Gerrit Triggers.
362 ######################
363 # Default parameters #
364 ######################
367 build-days-to-keep: 30 # 30 days in case a release takes long to get approved.
369 git-url: '$GIT_URL/$PROJECT'
370 java-version: openjdk8
371 mvn-global-settings: global-settings
375 staging-profile-id: '' # Unused by the javadoc jobs
377 submodule-recursive: true
379 gerrit_javadoc_verify_triggers:
380 - patchset-created-event:
382 exclude-trivial-rebase: false
383 exclude-no-code-change: false
384 - draft-published-event
385 - comment-added-contains-event:
386 comment-contains-value: recheck$
388 #####################
389 # Job Configuration #
390 #####################
394 mvn-version: '{mvn-version}'
395 - lf-provide-maven-settings:
396 global-settings-file: '{mvn-global-settings}'
397 settings-file: '{mvn-settings}'
398 - shell: !include-raw-escape:
399 - ../shell/common-variables.sh
400 - ../shell/maven-javadoc-generate.sh
401 - lf-provide-maven-settings-cleanup
404 name: '{project-name}-maven-javadoc-verify-{stream}'
405 id: gerrit-maven-javadoc-verify
407 # yamllint disable-line rule:key-duplicates
408 <<: *lf_maven_javadoc_verify
411 - lf-infra-gerrit-scm:
412 jenkins-ssh-credential: '{jenkins-ssh-credential}'
414 refspec: '$GERRIT_REFSPEC'
415 branch: '$GERRIT_BRANCH'
416 submodule-recursive: '{submodule-recursive}'
417 choosing-strategy: gerrit
421 server-name: '{gerrit-server-name}'
422 trigger-on: '{obj:gerrit_javadoc_verify_triggers}'
424 - project-compare-type: ANT
425 project-pattern: '{project}'
427 - branch-compare-type: ANT
428 branch-pattern: '**/{branch}'
431 name: '{project-name}-maven-javadoc-verify-{stream}'
432 id: github-maven-javadoc-verify
434 # yamllint disable-line rule:key-duplicates
435 <<: *lf_maven_javadoc_verify
439 url: '{git-url}/{github-org}/{project}'
442 - lf-infra-github-scm:
443 url: '{git-clone-url}{github-org}/{project}'
444 refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
446 submodule-recursive: '{submodule-recursive}'
447 choosing-strategy: default
448 jenkins-ssh-credential: '{jenkins-ssh-credential}'
451 - lf-infra-github-pr-trigger:
452 trigger-phrase: '^recheck$'
453 only-trigger-phrase: true
454 status-context: 'Maven Javadoc'
460 github_pr_admin_list:
467 - lf_maven_release: &lf_maven_release
468 name: lf-maven-release
470 # Produces a release candidate by creating a staging repo in Nexus.
472 # Runs a Maven build and deploys to $WORKSPACE/m2repo directory. This
473 # directory can then be reused later to deploy to Nexus.
475 # Required parameters:
476 # :build-node: The node to run build on.
477 # :jenkins-ssh-credential: Credential to use for SSH. (Generally should
478 # be configured in defaults.yaml)
479 # :mvn-settings: The name of settings file containing credentials for
481 # :mvn-staging-id: Maven Server ID from settings.xml to pull credentials from.
482 # (Note: This setting should be configured in defaults.yaml.)
483 # :staging-profile-id: Profile ID of the project's Nexus staging profile.
485 # Optional parameters:
486 # :gerrit_verify_triggers: Override Gerrit Triggers.
487 # :mvn-global-settings: The name of the Maven global settings to use for
488 # Maven configuration. (default: global-settings)
489 # :cron: Cron schedule when to trigger the job. This parameter also
490 # supports multiline input via YAML pipe | character in cases where
491 # one may want to provide more than 1 cron timer. (default: '')
493 ######################
494 # Default parameters #
495 ######################
498 build-days-to-keep: 30 # 30 days in case a release takes long to get approved.
500 git-url: '$GIT_URL/$PROJECT'
501 java-version: openjdk8
502 mvn-global-settings: global-settings
507 submodule-recursive: true
510 gerrit_release_triggers:
511 - comment-added-contains-event:
512 comment-contains-value: build release$
514 #####################
515 # Job Configuration #
516 #####################
519 - lf-jacoco-nojava-workaround
521 mvn-version: '{mvn-version}'
522 - lf-provide-maven-settings:
523 global-settings-file: '{mvn-global-settings}'
524 settings-file: '{mvn-settings}'
525 - lf-infra-create-netrc:
526 server-id: '{mvn-staging-id}'
527 - shell: !include-raw-escape:
528 - ../shell/lftools-install.sh
529 - ../shell/common-variables.sh
530 - ../shell/maven-patch-release.sh
531 - ../shell/maven-build.sh
532 - ../shell/maven-stage.sh
533 - lf-provide-maven-settings-cleanup
536 name: '{project-name}-maven-release-{stream}'
537 id: gerrit-maven-release
539 # yamllint disable-line rule:key-duplicates
540 <<: *lf_maven_release
543 - lf-infra-gerrit-scm:
544 jenkins-ssh-credential: '{jenkins-ssh-credential}'
546 refspec: '$GERRIT_REFSPEC'
547 branch: '$GERRIT_BRANCH'
548 submodule-recursive: '{submodule-recursive}'
549 choosing-strategy: default
552 - timed: '{obj:cron}'
554 server-name: '{gerrit-server-name}'
555 trigger-on: '{obj:gerrit_release_triggers}'
557 - project-compare-type: ANT
558 project-pattern: '{project}'
560 - branch-compare-type: ANT
561 branch-pattern: '**/{branch}'
564 name: '{project-name}-maven-release-{stream}'
565 id: github-maven-release
567 # yamllint disable-line rule:key-duplicates
568 <<: *lf_maven_release
572 url: '{git-url}/{github-org}/{project}'
575 - lf-infra-github-scm:
576 url: '{git-clone-url}{github-org}/{project}'
577 refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
579 submodule-recursive: '{submodule-recursive}'
580 choosing-strategy: default
581 jenkins-ssh-credential: '{jenkins-ssh-credential}'
584 - timed: '{obj:cron}'
585 - lf-infra-github-pr-trigger:
586 trigger-phrase: '^build release$'
587 only-trigger-phrase: true
588 status-context: 'Maven Release'
594 github_pr_admin_list:
601 - lf_maven_sonar: &lf_maven_sonar
604 # Sonar job which runs mvn clean install then publishes to Sonar.
606 # This job purposely only runs on the master branch as there are Additional
607 # configuration needed to support multiple branches and there's not much
608 # interest in that kind of support.
610 # Required parameters:
612 # :build-node: The node to run build on.
613 # :jenkins-ssh-credential: Credential to use for SSH. (Generally should
614 # be configured in defaults.yaml)
615 # :mvn-settings: The name of settings file containing credentials for
618 # Optional parameters:
620 # :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
621 # :build-timeout: Timeout in seconds before aborting build. (default: 60)
622 # :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
623 # :java-version: Version of Java to use for the build. (default: openjdk8)
624 # :mvn-global-settings: The name of the Maven global settings to use for
625 # Maven configuration. (default: global-settings)
626 # :mvn-opts: Sets MAVEN_OPTS. (default: '')
627 # :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
628 # :mvn-version: Version of maven to use. (default: mvn33)
629 # :submodule-recursive: Whether to checkout submodules recursively.
632 # :gerrit_sonar_triggers: Override Gerrit Triggers.
634 ######################
635 # Default parameters #
636 ######################
638 branch: master # Sonar should always be run on master branch
639 build-days-to-keep: 7
641 git-url: '$GIT_URL/$PROJECT'
642 java-version: openjdk8
643 mvn-global-settings: global-settings
647 staging-profile-id: '' # Unused in this job
649 submodule-recursive: true
651 gerrit_sonar_triggers:
652 - comment-added-contains-event:
653 comment-contains-value: run-sonar$
655 #####################
656 # Job Configuration #
657 #####################
662 server-name: '{gerrit-server-name}'
663 trigger-on: '{obj:gerrit_sonar_triggers}'
665 - project-compare-type: 'ANT'
666 project-pattern: '{project}'
668 - branch-compare-type: 'ANT'
669 branch-pattern: '**/master'
677 - lf-infra-maven-sonar:
678 mvn-settings: '{mvn-settings}'
679 mvn-version: '{mvn-version}'
687 name: lf-infra-maven-sonar
688 # Run a Sonar build with Maven
691 mvn-version: '{mvn-version}'
693 # Switch this to the sonar wrapper when JJB 2.0 is available
694 properties-content: |
695 SONAR_HOST_URL=$SONAR_URL
696 SONAR_MAVEN_GOAL=sonar:sonar
697 - lf-provide-maven-settings:
698 global-settings-file: global-settings
699 settings-file: '{mvn-settings}'
700 - shell: !include-raw-escape:
701 - ../shell/common-variables.sh
702 - ../shell/maven-sonar.sh
703 - lf-provide-maven-settings-cleanup
706 name: '{project-name}-sonar'
707 id: gerrit-maven-sonar
709 # yamllint disable-line rule:key-duplicates
713 - lf-infra-gerrit-scm:
714 jenkins-ssh-credential: '{jenkins-ssh-credential}'
716 refspec: $GERRIT_REFSPEC
717 branch: $GERRIT_BRANCH
718 submodule-recursive: '{submodule-recursive}'
719 choosing-strategy: default
722 name: '{project-name}-sonar'
723 id: github-maven-sonar
725 # yamllint disable-line rule:key-duplicates
730 url: '{git-url}/{github-org}/{project}'
733 - lf-infra-github-scm:
734 url: '{git-clone-url}{github-org}/{project}'
735 refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
737 submodule-recursive: '{submodule-recursive}'
738 choosing-strategy: default
739 jenkins-ssh-credential: '{jenkins-ssh-credential}'
742 - lf-infra-github-pr-trigger:
743 trigger-phrase: '^recheck$'
744 only-trigger-phrase: false
745 status-context: 'Maven Verify'
751 github_pr_admin_list:
758 - lf_maven_verify: &lf_maven_verify
759 name: lf-maven-verify
761 # Verify job which runs mvn clean install to test a project build..
763 # Required parameters:
765 # :build-node: The node to run build on.
766 # :jenkins-ssh-credential: Credential to use for SSH. (Generally should
767 # be configured in defaults.yaml)
768 # :mvn-settings: The name of settings file containing credentials for
771 # Optional parameters:
773 # :branch: Git branch to fetch for the build. (default: master)
774 # :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
775 # :build-timeout: Timeout in seconds before aborting build. (default: 60)
776 # :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
777 # :java-version: Version of Java to use for the build. (default: openjdk8)
778 # :mvn-global-settings: The name of the Maven global settings to use for
779 # Maven configuration. (default: global-settings)
780 # :mvn-opts: Sets MAVEN_OPTS. (default: '')
781 # :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
782 # :mvn-version: Version of maven to use. (default: mvn33)
783 # :stream: Keyword that can be used to represent a release code-name.
784 # Often the same as the branch. (default: master)
785 # :submodule-recursive: Whether to checkout submodules recursively.
788 # :gerrit_verify_triggers: Override Gerrit Triggers.
789 # :gerrit_trigger_file_paths: Override file paths which can be used to
790 # filter which file modifications will trigger a build.
792 ######################
793 # Default parameters #
794 ######################
797 build-days-to-keep: 7
799 git-url: '$GIT_URL/$PROJECT'
800 java-version: openjdk8
801 mvn-global-settings: global-settings
803 mvn-params: '-Dstream=$STREAM'
805 staging-profile-id: '' # Unused in this job
807 submodule-recursive: true
809 gerrit_verify_triggers:
810 - patchset-created-event:
812 exclude-trivial-rebase: false
813 exclude-no-code-change: false
814 - draft-published-event
815 - comment-added-contains-event:
816 comment-contains-value: recheck$
817 gerrit_trigger_file_paths:
821 #####################
822 # Job Configuration #
823 #####################
828 - lf-jacoco-nojava-workaround
830 mvn-version: '{mvn-version}'
831 - lf-provide-maven-settings:
832 global-settings-file: '{mvn-global-settings}'
833 settings-file: '{mvn-settings}'
834 - shell: !include-raw-escape:
835 - ../shell/lftools-install.sh
836 - ../shell/common-variables.sh
837 - ../shell/maven-build.sh
838 - lf-provide-maven-settings-cleanup
846 name: '{project-name}-maven-verify-{stream}-{mvn-version}-{java-version}'
847 id: gerrit-maven-verify
849 # yamllint disable-line rule:key-duplicates
853 - lf-infra-gerrit-scm:
854 jenkins-ssh-credential: '{jenkins-ssh-credential}'
856 refspec: '$GERRIT_REFSPEC'
857 branch: '$GERRIT_BRANCH'
858 submodule-recursive: '{submodule-recursive}'
859 choosing-strategy: gerrit
863 server-name: '{gerrit-server-name}'
864 trigger-on: '{obj:gerrit_verify_triggers}'
866 - project-compare-type: ANT
867 project-pattern: '{project}'
869 - branch-compare-type: ANT
870 branch-pattern: '**/{branch}'
871 file-paths: '{obj:gerrit_trigger_file_paths}'
874 name: '{project-name}-maven-verify-{stream}-{mvn-version}-{java-version}'
875 id: github-maven-verify
877 # yamllint disable-line rule:key-duplicates
882 url: '{git-url}/{github-org}/{project}'
885 - lf-infra-github-scm:
886 url: '{git-clone-url}{github-org}/{project}'
887 refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
889 submodule-recursive: '{submodule-recursive}'
890 choosing-strategy: default
891 jenkins-ssh-credential: '{jenkins-ssh-credential}'
894 - lf-infra-github-pr-trigger:
895 trigger-phrase: '^recheck$'
896 only-trigger-phrase: false
897 status-context: 'Maven Verify'
903 github_pr_admin_list: