8 .. include:: ../job-groups.rst
10 Below is a list of Maven job groups:
12 .. literalinclude:: ../../jjb/lf-maven-job-groups.yaml
22 Runs Sonar against a Maven project.
26 :java-version: Version of Java to execute Sonar with.
27 :mvn-version: Version of Maven to execute Sonar with.
28 :mvn-settings: Maven settings.xml file containing credentials to use.
30 lf-infra-maven-sonarcloud
31 -------------------------
33 Runs Sonar against a Maven project and pushes results to SonarCloud.
37 :java-version: Version of Java to execute Maven build. (default: openjdk8)
38 :mvn-version: Version of Maven to execute Sonar with.
39 :mvn-settings: Maven settings.xml file containing credentials to use.
40 :sonarcloud-project-key: SonarCloud project key.
41 :sonarcloud-project-organization: SonarCloud project organization.
42 :sonarcloud-api-token: SonarCloud API Token.
43 :sonarcloud-java-version: Version of Java to run the Sonar scan.
48 Calls the maven build script to perform a maven build.
52 :mvn-goals: The maven goals to perform for the build.
53 (default: clean deploy)
58 Common Jenkins configuration for Maven jobs.
63 Calls the maven deploy script to push artifacts to Nexus.
65 lf-maven-versions-plugin
66 ------------------------
68 Conditionally calls Maven versions plugin to set, update and commit the maven `versions:set`.
72 :maven-versions-plugin: Whether to call Maven versions plugin or not. (default: false)
73 :version-properties-file: Name and path of the version properties file.
74 (default: version.properties)
75 :mvn-version: Version of Maven to execute Sonar with.
76 :mvn-pom: Location of pom.xml.
77 :mvn-settings: Maven settings.xml file containing credentials to use.
82 Calls the maven stage script to push artifacts to a Nexus staging repository.
86 :mvn-global-settings: The name of the Maven global settings to use for
88 :mvn-settings: The name of settings file containing credentials for the project.
90 lf-update-java-alternatives
91 ---------------------------
93 Setup Java alternatives for the Distro.
97 :java-version: Version of Java to set as the default Java.
100 lf-infra-sonatype-clm
101 ---------------------
103 Runs a Sonatype CLM scan against a Maven project and pushes results to
106 :Optional parameters:
107 :mvn-goals: The maven goals to perform for the build.
108 (default: clean install)
116 Produces a CLM scan of the code into Nexus IQ Server.
120 - {project-name}-maven-clm-{stream}
124 :Comment Trigger: run-clm
126 :Required parameters:
128 :build-node: The node to run build on.
129 :jenkins-ssh-credential: Credential to use for SSH. (Generally configured in defaults.yaml)
130 :mvn-settings: The name of settings file containing credentials for the project.
132 :Optional parameters:
134 :branch: The branch to build against. (default: master)
135 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
136 :build-timeout: Timeout in minutes before aborting build. (default: 60)
137 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
138 :java-version: Version of Java to use for the build. (default: openjdk8)
139 :mvn-global-settings: The name of the Maven global settings to use for
140 Maven configuration. (default: global-settings)
141 :mvn-goals: The maven goals to perform for the build.
142 (default: clean install)
143 :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
144 :mvn-params: Parameters to pass to the mvn CLI. (default: '')
145 :mvn-version: Version of maven to use. (default: mvn35)
146 :nexus-iq-namespace: Insert a namespace to project AppID for projects that
147 share a Nexus IQ system to avoid project name collision. We recommend
148 inserting a trailing - dash if using this parameter.
149 For example 'odl-'. (default: '')
150 :nexus-iq-stage: Sets the **stage** which the policy evaluation will run
151 against on the Nexus IQ Server. (default: 'build')
152 :stream: Keyword that represents a release code-name.
153 Often the same as the branch. (default: master)
154 :submodule-recursive: Whether to checkout submodules recursively.
156 :submodule-timeout: Timeout (in minutes) for checkout operation.
158 :submodule-disable: Disable submodule checkout operation.
161 :gerrit_merge_triggers: Override Gerrit Triggers.
163 Maven JavaDoc Publish
164 ---------------------
166 Produces and publishes javadocs for a Maven project.
168 Expects javadocs to be available in ``$WORKSPACE/target/site/apidocs``, but
169 overrideable with the ``mvn-dir`` parameter. If set, will search for javadocs
170 in ``$WORKSPACE/{mvn-dir}/target/site/apidocs``.
174 - {project-name}-maven-javadoc-publish-{stream}-{java-version}
175 - gerrit-maven-javadoc-publish
176 - github-maven-javadoc-publish
178 :Comment Trigger: remerge
180 :Required parameters:
182 :build-node: The node to run build on.
183 :javadoc-path: The path in Nexus to deploy javadoc to.
184 :jenkins-ssh-credential: Credential to use for SSH. (Generally configured in defaults.yaml)
185 :mvn-settings: The name of settings file containing credentials for the project.
186 :mvn-site-id: Maven Server ID from settings.xml to pull credentials from.
187 (Note: This setting is generally configured in ``defaults.yaml``.)
189 :Optional parameters:
191 :branch: The branch to build against. (default: master)
192 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
193 :build-timeout: Timeout in minutes before aborting build. (default: 60)
194 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
195 :java-version: Version of Java to use for the build. (default: openjdk8)
196 :mvn-dir: Directory supplied as argument to -f option (default: '.')
197 :mvn-global-settings: The name of the Maven global settings to use for
198 Maven configuration. (default: global-settings)
199 :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
200 :mvn-params: Parameters to pass to the mvn CLI. (default: '')
201 Must not include a "-f" option; see parameter mvn-dir.
202 :mvn-version: Version of maven to use. (default: mvn35)
203 :stream: Keyword that represents a release code-name.
204 Often the same as the branch. (default: master)
205 :submodule-recursive: Whether to checkout submodules recursively.
207 :submodule-timeout: Timeout (in minutes) for checkout operation.
209 :submodule-disable: Disable submodule checkout operation.
212 :gerrit_merge_triggers: Override Gerrit Triggers.
217 Produces javadocs for a Maven project.
219 Expects javadocs to be available in ``$WORKSPACE/target/site/apidocs``, but
220 overrideable with the ``mvn-dir`` parameter. If set, will search for javadocs
221 in ``$WORKSPACE/{mvn-dir}/target/site/apidocs``.
225 - {project-name}-maven-javadoc-verify-{stream}-{java-version}
226 - gerrit-maven-javadoc-verify
227 - github-maven-javadoc-verify
229 :Comment Trigger: recheck|reverify
231 :Required parameters:
232 :build-node: The node to run build on.
233 :jenkins-ssh-credential: Credential to use for SSH. (Generally configured in defaults.yaml)
234 :mvn-settings: The name of settings file containing credentials for the project.
236 :Optional parameters:
238 :branch: The branch to build against. (default: master)
239 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
240 :build-timeout: Timeout in minutes before aborting build. (default: 60)
241 :deploy-path: The path in Nexus to deploy javadoc to. (default: $PROJECT/$STREAM)
242 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
243 :java-version: Version of Java to use for the build. (default: openjdk8)
244 :mvn-dir: Directory supplied as argument to -f option (default: '.')
245 :mvn-global-settings: The name of the Maven global settings to use for
246 Maven configuration. (default: global-settings)
247 :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
248 :mvn-params: Parameters to pass to the mvn CLI. (default: '')
249 Must not include a "-f" option; see parameter mvn-dir.
250 :mvn-version: Version of maven to use. (default: mvn35)
251 :stream: Keyword that represents a release code-name.
252 Often the same as the branch. (default: master)
253 :submodule-recursive: Whether to checkout submodules recursively.
255 :submodule-timeout: Timeout (in minutes) for checkout operation.
257 :submodule-disable: Disable submodule checkout operation.
260 :gerrit_verify_triggers: Override Gerrit Triggers.
265 Merge job which runs `mvn clean deploy` to build a project.
267 This job pushes files to Nexus using cURL instead of allowing the Maven deploy
268 goal to push the upload. This is to get around the issue that Maven deploy does
269 not properly support uploading files at the end of the build and instead pushes
270 as it goes. There exists a ``-Ddeploy-at-end`` feature but it does not work
273 This job uses the following strategy to deploy jobs to Nexus:
275 1. ``wget -r`` to fetch maven-metadata.xml from Nexus
276 2. ``mvn deploy -DaltDeploymentRepository`` to prepare files for upload
277 3. Removes untouched maven-metadata.xml files before upload
278 4. Use lftools (cURL) upload script to push artifacts to Nexus
282 - {project-name}-maven-merge-{stream}
286 :Comment Trigger: remerge
288 :Required parameters:
290 :build-node: The node to run build on.
291 :jenkins-ssh-credential: Credential to use for SSH. (Generally configured in defaults.yaml)
292 :mvn-settings: The name of settings file containing credentials for the project.
293 :mvn-snapshot-id: Maven Server ID from settings.xml to pull credentials from.
294 (Note: This setting is generally configured in ``defaults.yaml``.)
295 :nexus-snapshot-repo: The repository id of the Nexus snapshot repo to deploy to.
297 :Optional parameters:
299 :branch: Git branch to fetch for the build. (default: master)
300 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
301 :build-timeout: Timeout in minutes before aborting build. (default: 60)
302 :cron: Cron schedule when to trigger the job. This parameter also
303 supports multiline input via YAML pipe | character in cases where
304 one may want to provide more than 1 cron timer. (default: 'H H * * 0'
306 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
307 :java-version: Version of Java to use for the build. (default: openjdk8)
308 :mvn-global-settings: The name of the Maven global settings to use for
309 Maven configuration. (default: global-settings)
310 :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
311 :mvn-params: Parameters to pass to the mvn CLI. (default: '')
312 :mvn-version: Version of maven to use. (default: mvn35)
313 :nexus-cut-dirs: Number of directories to cut from file path for `wget -r`.
314 :stream: Keyword that represents a release code-name.
315 Often the same as the branch. (default: master)
316 :submodule-recursive: Whether to checkout submodules recursively.
318 :submodule-timeout: Timeout (in minutes) for checkout operation.
320 :submodule-disable: Disable submodule checkout operation.
323 :gerrit_merge_triggers: Override Gerrit Triggers.
324 :gerrit_trigger_file_paths: Override file paths to filter which file
325 modifications will trigger a build.
327 Maven Merge for Docker
328 ----------------------
330 Produces a snapshot docker image in a Nexus registry. Appropriate for
331 Java projects that do not need to deploy any POM or JAR files.
333 Like the Maven Merge job as described above but logs in to Docker
334 registries first and skips the lf-maven-deploy builder. The project
335 POM file should invoke a plugin to build and push a Docker image.
336 This pulls the base image from the registry in the environment
337 variable ``CONTAINER_PULL_REGISTRY`` and pushes new image into the
338 registry in the environment variable ``CONTAINER_PUSH_REGISTRY``.
342 - {project-name}-maven-docker-merge-{stream}
343 - gerrit-maven-docker-merge
344 - github-maven-docker-merge
346 :Required parameters:
348 :container-public-registry: Docker registry source with base images.
349 :container-snapshot-registry: Docker registry target for the deploy action.
351 All other required and optional parameters are identical to the Maven Merge job
357 Produces a release candidate by creating a staging repo in Nexus.
359 The staging repo name is in the format PROJECT-NUMBER for example "aaa-1234",
360 "autorelease-2000", "odlparent-1201", etc...
362 This job runs a Maven build and deploys to $WORKSPACE/m2repo directory. This
363 directory is then used later to deploy to Nexus.
367 - {project-name}-maven-stage-{stream}
371 :Comment Trigger: "stage-release" or "stage-maven-release"
373 :Required parameters:
375 :build-node: The node to run build on.
376 :jenkins-ssh-credential: Credential to use for SSH. (Generally configured in defaults.yaml)
377 :mvn-settings: The name of settings file containing credentials for the project.
378 :mvn-staging-id: Maven Server ID from settings.xml to pull credentials from.
379 (Note: This setting is generally configured in ``defaults.yaml``.)
380 :staging-profile-id: Profile ID of the project's Nexus staging profile.
382 :Optional parameters:
384 :archive-artifacts: Artifacts to archive to the logs server (default: '').
385 :branch: The branch to build against. (default: master)
386 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
387 :build-timeout: Timeout in minutes before aborting build. (default: 60)
388 :cron: Cron schedule when to trigger the job. This parameter also
389 supports multiline input via YAML pipe | character in cases where
390 one may want to provide more than 1 cron timer. (default: '')
391 :deploy-path: The path in Nexus to deploy javadoc to. (default: $PROJECT/$STREAM)
392 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
393 :java-version: Version of Java to use for the build. (default: openjdk8)
394 :mvn-central: Set to ``true`` to also stage to **OSSRH**. This is for projects
395 that want to release to Maven Central. If set, then also set the parameter
396 ``ossrh-profile-id``. (default: false)
397 :maven-versions-plugin: Whether to call Maven versions plugin or not. (default: false)
398 :mvn-global-settings: The name of the Maven global settings to use for
399 Maven configuration. (default: global-settings)
400 :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
401 :mvn-params: Parameters to pass to the mvn CLI. (default: '')
402 :mvn-version: Version of maven to use. (default: mvn35)
403 :ossrh-profile-id: Profile ID for project as provided by OSSRH.
405 :sign-artifacts: Sign artifacts with Sigul. (default: false)
406 :stream: Keyword that represents a release code-name.
407 Often the same as the branch. (default: master)
408 :submodule-recursive: Whether to checkout submodules recursively.
410 :submodule-timeout: Timeout (in minutes) for checkout operation.
412 :submodule-disable: Disable submodule checkout operation.
414 :version-properties-file: Name and path of the version properties file.
415 (default: version.properties)
417 :gerrit_release_triggers: Override Gerrit Triggers.
418 :gerrit_trigger_file_paths: Override file paths to filter which file
419 modifications will trigger a build.
421 Maven Stage for Docker
422 ----------------------
424 Produces a release candidate docker image in a Nexus registry.
425 Appropriate for Java projects that do not need to deploy any POM or
428 Like the Maven Stage job as described above but logs in to Docker
429 registries first and skips the lf-maven-deploy builder. The project
430 POM file should invoke a plugin to build and push a Docker image.
431 This pulls the base image from the registry in the environment
432 variable ``CONTAINER_PULL_REGISTRY`` and pushes new image into the
433 registry in the environment variable ``CONTAINER_PUSH_REGISTRY``.
437 - {project-name}-maven-docker-stage-{stream}
438 - gerrit-maven-docker-stage
439 - github-maven-docker-stage
441 :Comment Trigger: "stage-release" or "stage-docker-release"
443 :Required parameters:
445 :container-public-registry: Docker registry source with base images.
446 :container-staging-registry: Docker registry target for the deploy action.
448 :Optional parameters:
450 :gerrit_release_docker_triggers: Override Gerrit Triggers.
452 All other required and optional parameters are identical to the Maven Stage job
460 Sonar job which runs mvn clean install then publishes to Sonar.
462 This job purposely runs on the ``master`` branch and does not support
463 multi-branch configuration.
467 - {project-name}-sonar
471 :Comment Trigger: run-sonar
473 :Required parameters:
475 :build-node: The node to run build on.
476 :jenkins-ssh-credential: Credential to use for SSH. (Generally configured in defaults.yaml)
477 :mvn-settings: The name of settings file containing credentials for the project.
479 :Optional parameters:
481 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
482 :build-timeout: Timeout in minutes before aborting build. (default: 60)
483 :cron: Cron schedule when to trigger the job. This parameter also
484 supports multiline input via YAML pipe | character in cases where
485 one may want to provide more than 1 cron timer. (default: 'H H * * 6'
487 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
488 :java-version: Version of Java to use for the Maven build. (default: openjdk8)
489 :mvn-global-settings: The name of the Maven global settings to use for
490 Maven configuration. (default: global-settings)
491 :mvn-goals: The maven goals to perform for the build.
492 (default: clean install)
493 :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
494 :mvn-params: Parameters to pass to the mvn CLI. (default: '')
495 :mvn-version: Version of maven to use. (default: mvn35)
496 :sonar-mvn-goals: Maven goals to run for sonar analysis.
497 (default: sonar:sonar)
498 :sonarcloud: Set to ``true`` to use SonarCloud ``true|false``.
500 :sonarcloud-project-key: SonarCloud project key. (default: '')
501 :sonarcloud-project-organization: SonarCloud project organization.
503 :sonarcloud-api-token: SonarCloud API Token. (default: '')
504 :sonarcloud-java-version: Version of Java to use for the Sonar scan. (default: openjdk11)
505 :stream: Keyword that represents a release code-name.
506 Often the same as the branch. (default: master)
507 :submodule-recursive: Whether to checkout submodules recursively.
509 :submodule-timeout: Timeout (in minutes) for checkout operation.
511 :submodule-disable: Disable submodule checkout operation.
514 :gerrit_sonar_triggers: Override Gerrit Triggers.
519 .. literalinclude:: ../../.jjb-test/lf-maven-jobs/maven-sonarcloud.yaml
525 Verify job which runs mvn clean install to test a project build..
529 - {project-name}-maven-verify-{stream}-{mvn-version}-{java-version}
530 - gerrit-maven-verify
531 - github-maven-verify
533 :Comment Trigger: recheck|reverify
535 :Required parameters:
537 :build-node: The node to run build on.
538 :jenkins-ssh-credential: Credential to use for SSH. (Generally configured in defaults.yaml)
539 :mvn-settings: The name of settings file containing credentials for the project.
541 :Optional parameters:
543 :branch: Git branch to fetch for the build. (default: master)
544 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
545 :build-timeout: Timeout in minutes before aborting build. (default: 60)
546 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
547 :java-version: Version of Java to use for the build. (default: openjdk8)
548 :mvn-global-settings: The name of the Maven global settings to use for
549 Maven configuration. (default: global-settings)
550 :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
551 :mvn-params: Parameters to pass to the mvn CLI. (default: '')
552 :mvn-version: Version of maven to use. (default: mvn35)
553 :stream: Keyword that represents a release code-name.
554 Often the same as the branch. (default: master)
555 :submodule-recursive: Whether to checkout submodules recursively.
557 :submodule-timeout: Timeout (in minutes) for checkout operation.
559 :submodule-disable: Disable submodule checkout operation.
562 :gerrit_verify_triggers: Override Gerrit Triggers.
563 :gerrit_trigger_file_paths: Override file paths to filter which file
564 modifications will trigger a build.
566 Maven Verify for Docker
567 -----------------------
569 Like the Maven Verify job as described above but logs in to Docker
570 registries first. The project POM file should invoke a plugin to build
571 a Docker image. This pulls the base image from the registry in the environment
572 variable ``CONTAINER_PULL_REGISTRY``.
576 - {project-name}-maven-docker-verify-{stream}-{mvn-version}-{java-version}
577 - gerrit-maven-docker-verify
578 - github-maven-docker-verify
580 :Required parameters:
582 :container-public-registry: Docker registry source with base images.
584 All other required and optional parameters are identical to the Maven Verify job
587 Maven Verify w/ Dependencies
588 ----------------------------
590 Verify job which runs mvn clean install to test a project build /w deps
592 This job's purpose is to verify a patch in conjunction to a list of upstream
593 patches it depends on. The user of this job can provide a list of patches via
598 - {project-name}-maven-verify-deps-{stream}-{mvn-version}-{java-version}
599 - gerrit-maven-verify-dependencies
601 :Comment Trigger: recheck: SPACE_SEPARATED_LIST_OF_PATCHES
603 :Required parameters:
605 :build-node: The node to run build on.
606 :jenkins-ssh-credential: Credential to use for SSH. (Generally configured in defaults.yaml)
607 :mvn-settings: The name of settings file containing credentials for the project.
609 :Optional parameters:
611 :branch: Git branch to fetch for the build. (default: master)
612 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
613 :build-timeout: Timeout in minutes before aborting build. (default: 60)
614 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
615 :java-version: Version of Java to use for the build. (default: openjdk8)
616 :mvn-global-settings: The name of the Maven global settings to use for
617 Maven configuration. (default: global-settings)
618 :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
619 :mvn-params: Parameters to pass to the mvn CLI. (default: '')
620 :mvn-version: Version of maven to use. (default: mvn35)
621 :stream: Keyword that represents a release code-name.
622 Often the same as the branch. (default: master)
623 :submodule-recursive: Whether to checkout submodules recursively.
625 :submodule-timeout: Timeout (in minutes) for checkout operation.
627 :submodule-disable: Disable submodule checkout operation.
630 :gerrit_verify_triggers: Override Gerrit Triggers.
631 :gerrit_trigger_file_paths: Override file paths to filter which file
632 modifications will trigger a build.