Chore: Update Sonar OpenJDK version
[releng/global-jjb.git] / docs / jjb / lf-maven-jobs.rst
1 ##########
2 Maven Jobs
3 ##########
4
5 Job Groups
6 ==========
7
8 .. include:: ../job-groups.rst
9
10 Below is a list of Maven job groups:
11
12 .. literalinclude:: ../../jjb/lf-maven-job-groups.yaml
13    :language: yaml
14
15
16 Macros
17 ======
18
19 lf-infra-maven-sonar
20 --------------------
21
22 Runs Sonar against a Maven project.
23
24 :Required Parameters:
25
26     :java-version: Version of Java to execute Sonar with. (default: openjdk13)
27     :mvn-version: Version of Maven to execute Sonar with.
28     :mvn-settings: Maven settings.xml file containing credentials to use.
29
30 lf-infra-maven-sonarcloud
31 -------------------------
32
33 Runs Sonar against a Maven project and pushes results to SonarCloud.
34
35 :Required Parameters:
36
37     :java-version: Version of Java to execute Maven build. (default: openjdk11)
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-java-version: Version of Java to run the Sonar scan. (default: openjdk13)
43     :sonarcloud-qualitygate-wait: SonarCloud flag that forces the analysis step to
44         wait for the quality gate result. (default: false)
45
46 lf-maven-build
47 --------------
48
49 Calls the maven build script to perform a maven build.
50
51 :Required parameters:
52
53     :mvn-goals: The maven goals to perform for the build.
54         (default: clean deploy)
55
56 lf-maven-common
57 ---------------
58
59 Common Jenkins configuration for Maven jobs.
60
61 lf-maven-deploy
62 ---------------
63
64 Calls the maven deploy script to push artifacts to Nexus.
65
66 lf-maven-versions-plugin
67 ------------------------
68
69 Conditionally calls Maven versions plugin to set, update and commit the maven `versions:set`.
70
71 :Required Parameters:
72
73     :maven-versions-plugin: Whether to call Maven versions plugin or not. (default: false)
74     :version-properties-file: Name and path of the version properties file.
75         (default: version.properties)
76     :mvn-version: Version of Maven to execute Sonar with.
77     :mvn-pom: Location of pom.xml.
78     :mvn-settings: Maven settings.xml file containing credentials to use.
79
80 lf-maven-stage
81 --------------
82
83 Calls the maven stage script to push artifacts to a Nexus staging repository.
84
85 :Required Parameters:
86
87     :mvn-global-settings: The name of the Maven global settings to use for
88         Maven configuration.
89     :mvn-settings: The name of settings file containing credentials for the project.
90
91 lf-update-java-alternatives
92 ---------------------------
93
94 Setup Java alternatives for the Distro.
95
96 :Required Parameters:
97
98     :java-version: Version of Java to set as the default Java.
99         Eg. openjdk11
100
101 lf-infra-sonatype-clm
102 ---------------------
103
104 Runs a Sonatype CLM scan against a Maven project and pushes results to
105 Nexus IQ server.
106
107 :Optional parameters:
108     :mvn-goals: The maven goals to perform for the build.
109         (default: clean install)
110
111 lf-infra-snyk-cli-scanner
112 -------------------------
113
114 Downloads the latest Snyk CLI and triggers a code scan. It publishes a report into
115 the Snyk dashboard.
116
117 :Optional parameters:
118     :mvn-goals: The maven goals to perform for the build.
119         (default: clean install)
120
121 lf-infra-maven-sbom-generator
122 -----------------------------
123
124 Runs a specific version of SPDX SBOM Generator tool to generate a report.
125 The calling job template sets the version to run in the SBOM_GENERATOR_VERSION parameter.
126
127 :Optional parameters:
128     :sbom-flags: SBOM generator options. See https://github.com/opensbom-generator/spdx-sbom-generator
129
130 Job Templates
131 =============
132
133 Maven CLM
134 ---------
135
136 Produces a CLM scan of the code into Nexus IQ Server.
137
138 :Template Names:
139
140     - {project-name}-maven-clm-{stream}
141     - gerrit-maven-clm
142     - github-maven-clm
143
144 :Comment Trigger: run-clm
145
146 :Required parameters:
147
148     :build-node:    The node to run build on.
149     :jenkins-ssh-credential: Credential to use for SSH. (Generally configured in defaults.yaml)
150     :mvn-settings: The name of settings file containing credentials for the project.
151
152 :Optional parameters:
153
154     :branch: The branch to build against. (default: master)
155     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
156     :build-timeout: Timeout in minutes before aborting build. (default: 60)
157     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
158     :java-version: Version of Java to use for the build. (default: openjdk11)
159     :mvn-global-settings: The name of the Maven global settings to use for
160         Maven configuration. (default: global-settings)
161     :mvn-goals: The maven goals to perform for the build.
162         (default: clean install)
163     :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
164     :mvn-params: Parameters to pass to the mvn CLI. (default: '')
165     :mvn-version: Version of maven to use. (default: mvn35)
166     :nexus-iq-namespace: Insert a namespace to project AppID for projects that
167         share a Nexus IQ system to avoid project name collision. We recommend
168         inserting a trailing - dash if using this parameter.
169         For example 'odl-'. (default: '')
170     :nexus-iq-stage: Sets the **stage** which the policy evaluation will run
171         against on the Nexus IQ Server. (default: 'build')
172     :stream: Keyword that represents a release code-name.
173         Often the same as the branch. (default: master)
174     :submodule-recursive: Whether to checkout submodules recursively.
175         (default: true)
176     :submodule-timeout: Timeout (in minutes) for checkout operation.
177         (default: 10)
178     :submodule-disable: Disable submodule checkout operation.
179         (default: false)
180
181     :gerrit_merge_triggers: Override Gerrit Triggers.
182
183 Maven SNYK CLI
184 --------------
185
186 Builds the code, downloads and runs a Snyk CLI scan of the code into the Snyk dashboard.
187
188 :Template Names:
189
190     - {project-name}-maven-snyk-cli-{stream}
191     - gerrit-maven-snyk-cli
192     - github-maven-snyk-cli
193
194 :Comment Trigger: run-snyk
195
196 :Required parameters:
197
198     :build-node:    The node to run build on.
199     :jenkins-ssh-credential: Credential to use for SSH. (Generally configured in defaults.yaml)
200     :mvn-settings: The name of settings file containing credentials for the project.
201     :snyk-token-credential-id: Snyk API token to communicate with Jenkins.
202     :snyk-org-credential-id: Snyk organization ID.
203
204 :Optional parameters:
205
206     :branch: The branch to build against. (default: master)
207     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
208     :build-timeout: Timeout in minutes before aborting build. (default: 60)
209     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
210     :java-version: Version of Java to use for the build. (default: openjdk11)
211     :mvn-global-settings: The name of the Maven global settings to use for
212         Maven configuration. (default: global-settings)
213     :mvn-goals: The maven goals to perform for the build.
214         (default: clean install)
215     :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
216     :mvn-params: Parameters to pass to the mvn CLI. (default: '')
217     :mvn-version: Version of maven to use. (default: mvn35)
218     :snyk-cli-options: Snyk CLI options. (default: '')
219     :stream: Keyword that represents a release code-name.
220         Often the same as the branch. (default: master)
221     :submodule-recursive: Whether to checkout submodules recursively.
222         (default: true)
223     :submodule-timeout: Timeout (in minutes) for checkout operation.
224         (default: 10)
225     :submodule-disable: Disable submodule checkout operation.
226         (default: false)
227
228     :gerrit_snyk_triggers: Override Gerrit Triggers.
229
230 Maven JavaDoc Publish
231 ---------------------
232
233 Produces and publishes javadocs for a Maven project.
234
235 Expects javadocs to be available in ``$WORKSPACE/target/site/apidocs``, but
236 overrideable with the ``mvn-dir`` parameter. If set, will search for javadocs
237 in ``$WORKSPACE/{mvn-dir}/target/site/apidocs``.
238
239 :Template Names:
240
241     - {project-name}-maven-javadoc-publish-{stream}-{java-version}
242     - gerrit-maven-javadoc-publish
243     - github-maven-javadoc-publish
244
245 :Comment Trigger: remerge
246
247 :Required parameters:
248
249     :build-node: The node to run build on.
250     :javadoc-path: The path in Nexus to deploy javadoc to.
251     :jenkins-ssh-credential: Credential to use for SSH. (Generally configured in defaults.yaml)
252     :mvn-settings: The name of settings file containing credentials for the project.
253     :mvn-site-id: Maven Server ID from settings.xml to pull credentials from.
254         (Note: This setting is generally configured in ``defaults.yaml``.)
255
256 :Optional parameters:
257
258     :branch: The branch to build against. (default: master)
259     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
260     :build-timeout: Timeout in minutes before aborting build. (default: 60)
261     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
262     :java-version: Version of Java to use for the build. (default: openjdk11)
263     :mvn-dir: Directory supplied as argument to -f option (default: '.')
264     :mvn-global-settings: The name of the Maven global settings to use for
265         Maven configuration. (default: global-settings)
266     :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
267     :mvn-params: Parameters to pass to the mvn CLI. (default: '')
268         Must not include a "-f" option; see parameter mvn-dir.
269     :mvn-version: Version of maven to use. (default: mvn35)
270     :stream: Keyword that represents a release code-name.
271         Often the same as the branch. (default: master)
272     :submodule-recursive: Whether to checkout submodules recursively.
273         (default: true)
274     :submodule-timeout: Timeout (in minutes) for checkout operation.
275         (default: 10)
276     :submodule-disable: Disable submodule checkout operation.
277         (default: false)
278
279     :gerrit_merge_triggers: Override Gerrit Triggers.
280
281 Maven JavaDoc Verify
282 --------------------
283
284 Produces javadocs for a Maven project.
285
286 Expects javadocs to be available in ``$WORKSPACE/target/site/apidocs``, but
287 overrideable with the ``mvn-dir`` parameter. If set, will search for javadocs
288 in ``$WORKSPACE/{mvn-dir}/target/site/apidocs``.
289
290 :Template Names:
291
292     - {project-name}-maven-javadoc-verify-{stream}-{java-version}
293     - gerrit-maven-javadoc-verify
294     - github-maven-javadoc-verify
295
296 :Comment Trigger: recheck|reverify
297
298 :Required parameters:
299     :build-node:    The node to run build on.
300     :jenkins-ssh-credential: Credential to use for SSH. (Generally configured in defaults.yaml)
301     :mvn-settings: The name of settings file containing credentials for the project.
302
303 :Optional parameters:
304
305     :branch: The branch to build against. (default: master)
306     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
307     :build-timeout: Timeout in minutes before aborting build. (default: 60)
308     :deploy-path:    The path in Nexus to deploy javadoc to. (default: $PROJECT/$STREAM)
309     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
310     :java-version: Version of Java to use for the build. (default: openjdk11)
311     :mvn-dir: Directory supplied as argument to -f option (default: '.')
312     :mvn-global-settings: The name of the Maven global settings to use for
313         Maven configuration. (default: global-settings)
314     :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
315     :mvn-params: Parameters to pass to the mvn CLI. (default: '')
316         Must not include a "-f" option; see parameter mvn-dir.
317     :mvn-version: Version of maven to use. (default: mvn35)
318     :stream: Keyword that represents a release code-name.
319         Often the same as the branch. (default: master)
320     :submodule-recursive: Whether to checkout submodules recursively.
321         (default: true)
322     :submodule-timeout: Timeout (in minutes) for checkout operation.
323         (default: 10)
324     :submodule-disable: Disable submodule checkout operation.
325         (default: false)
326
327     :gerrit_verify_triggers: Override Gerrit Triggers.
328
329 Maven Merge
330 -----------
331
332 Merge job which runs `mvn clean deploy` to build a project.
333
334 This job pushes files to Nexus using cURL instead of allowing the Maven deploy
335 goal to push the upload. This is to get around the issue that Maven deploy does
336 not properly support uploading files at the end of the build and instead pushes
337 as it goes. There exists a ``-Ddeploy-at-end`` feature but it does not work
338 with extensions.
339
340 This job uses the following strategy to deploy jobs to Nexus:
341
342 1. ``wget -r`` to fetch maven-metadata.xml from Nexus
343 2. ``mvn deploy -DaltDeploymentRepository`` to prepare files for upload
344 3. Removes untouched maven-metadata.xml files before upload
345 4. Use lftools (cURL) upload script to push artifacts to Nexus
346
347 :Template Names:
348
349     - {project-name}-maven-merge-{stream}
350     - gerrit-maven-merge
351     - github-maven-merge
352
353 :Comment Trigger: remerge
354
355 :Required parameters:
356
357     :build-node: The node to run build on.
358     :jenkins-ssh-credential: Credential to use for SSH. (Generally configured in defaults.yaml)
359     :mvn-settings: The name of settings file containing credentials for the project.
360     :mvn-snapshot-id: Maven Server ID from settings.xml to pull credentials from.
361         (Note: This setting is generally configured in ``defaults.yaml``.)
362     :nexus-snapshot-repo: The repository id of the Nexus snapshot repo to deploy to.
363
364 :Optional parameters:
365
366     :branch: Git branch to fetch for the build. (default: master)
367     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
368     :build-timeout: Timeout in minutes before aborting build. (default: 60)
369     :cron: Cron schedule when to trigger the job. This parameter also
370         supports multiline input via YAML pipe | character in cases where
371         one may want to provide more than 1 cron timer. (default: 'H H * * 0'
372         to run weekly)
373     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
374     :jacoco-exclude-pattern: Ant-style patterns to exclude from Jacoco coverage
375         report. (default: ``"**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**"``)
376     :java-version: Version of Java to use for the build. (default: openjdk11)
377     :mvn-global-settings: The name of the Maven global settings to use for
378         Maven configuration. (default: global-settings)
379     :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
380     :mvn-params: Parameters to pass to the mvn CLI. (default: '')
381     :mvn-version: Version of maven to use. (default: mvn35)
382     :nexus-cut-dirs: Number of directories to cut from file path for `wget -r`.
383     :pre-build-script: Shell script to run before maven build. (default: a string with a shell comment)
384     :post-build-script: Shell script to run after maven build. (default: a string with a shell comment)
385     :stream: Keyword that represents a release code-name.
386         Often the same as the branch. (default: master)
387     :submodule-recursive: Whether to checkout submodules recursively.
388         (default: true)
389     :submodule-timeout: Timeout (in minutes) for checkout operation.
390         (default: 10)
391     :submodule-disable: Disable submodule checkout operation.
392         (default: false)
393
394     :gerrit_merge_triggers: Override Gerrit Triggers.
395     :gerrit_trigger_file_paths: Override file paths to filter which file
396         modifications will trigger a build.
397
398 Maven Merge for Docker
399 ----------------------
400
401 Produces a snapshot docker image in a Nexus registry. Appropriate for
402 Java projects that do not need to deploy any POM or JAR files.
403
404 Like the Maven Merge job as described above but logs in to Docker
405 registries first and skips the lf-maven-deploy builder. The project
406 POM file should invoke a plugin to build and push a Docker image.
407 This pulls the base image from the registry in the environment
408 variable ``CONTAINER_PULL_REGISTRY`` and pushes new image into the
409 registry in the environment variable ``CONTAINER_PUSH_REGISTRY``.
410
411 :Template Names:
412
413     - {project-name}-maven-docker-merge-{stream}
414     - gerrit-maven-docker-merge
415     - github-maven-docker-merge
416
417 :Required parameters:
418
419     :container-public-registry: Docker registry source with base images.
420     :container-snapshot-registry: Docker registry target for the deploy action.
421
422 All other required and optional parameters are identical to the Maven Merge job
423 described above.
424
425 Maven Stage
426 -----------
427
428 Produces a release candidate by creating a staging repo in Nexus.
429
430 The staging repo name is in the format PROJECT-NUMBER for example "aaa-1234",
431 "autorelease-2000", "odlparent-1201", etc...
432
433 This job runs a Maven build and deploys to $WORKSPACE/m2repo directory. This
434 directory is then used later to deploy to Nexus.
435
436 :Template Names:
437
438     - {project-name}-maven-stage-{stream}
439     - gerrit-maven-stage
440     - github-maven-stage
441
442 :Comment Trigger: "stage-release" or "stage-maven-release"
443
444 :Required parameters:
445
446     :build-node: The node to run build on.
447     :jenkins-ssh-credential: Credential to use for SSH. (Generally configured in defaults.yaml)
448     :mvn-settings: The name of settings file containing credentials for the project.
449     :mvn-staging-id: Maven Server ID from settings.xml to pull credentials from.
450         (Note: This setting is generally configured in ``defaults.yaml``.)
451     :staging-profile-id: Profile ID of the project's Nexus staging profile.
452
453 :Optional parameters:
454
455     :archive-artifacts: Artifacts to archive to the logs server (default: '').
456     :branch: The branch to build against. (default: master)
457     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
458     :build-timeout: Timeout in minutes before aborting build. (default: 60)
459     :cron: Cron schedule when to trigger the job. This parameter also
460         supports multiline input via YAML pipe | character in cases where
461         one may want to provide more than 1 cron timer. (default: '')
462     :deploy-path:    The path in Nexus to deploy javadoc to. (default: $PROJECT/$STREAM)
463     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
464     :java-version: Version of Java to use for the build. (default: openjdk11)
465     :mvn-central: Set to ``true`` to also stage to **OSSRH**. This is for projects
466         that want to release to Maven Central. If set, then also set the parameter
467         ``ossrh-profile-id``. (default: false)
468     :maven-versions-plugin: Whether to call Maven versions plugin or not. (default: false)
469     :mvn-global-settings: The name of the Maven global settings to use for
470         Maven configuration. (default: global-settings)
471     :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
472     :mvn-params: Parameters to pass to the mvn CLI. (default: '')
473     :mvn-version: Version of maven to use. (default: mvn35)
474     :ossrh-profile-id: Profile ID for project as provided by OSSRH.
475         (default: '')
476     :sbom-flags: SBOM generator options if using sbom-generator.
477         See https://github.com/opensbom-generator/spdx-sbom-generator
478     :sbom-generator: Calls lf-infra-maven-sbom-generator to run the SPDX SBOM generator tool.
479         (default: false)
480     :sbom-generator-version: SBOM generator version to download and run if using sbom-generator.
481         (default: v0.0.10)
482     :sbom-path: SBOM execution path.
483         (default: $WORKSPACE)
484     :sign-artifacts: Sign artifacts with Sigul. (default: false)
485     :stream: Keyword that represents a release code-name.
486         Often the same as the branch. (default: master)
487     :submodule-recursive: Whether to checkout submodules recursively.
488         (default: true)
489     :submodule-timeout: Timeout (in minutes) for checkout operation.
490         (default: 10)
491     :submodule-disable: Disable submodule checkout operation.
492         (default: false)
493     :version-properties-file: Name and path of the version properties file.
494         (default: version.properties)
495
496     :gerrit_release_triggers: Override Gerrit Triggers.
497     :gerrit_trigger_file_paths: Override file paths to filter which file
498         modifications will trigger a build.
499
500 Maven Stage for Docker
501 ----------------------
502
503 Produces a release candidate docker image in a Nexus registry.
504 Appropriate for Java projects that do not need to deploy any POM or
505 JAR files.
506
507 Like the Maven Stage job as described above but logs in to Docker
508 registries first and skips the lf-maven-deploy builder. The project
509 POM file should invoke a plugin to build and push a Docker image.
510 This pulls the base image from the registry in the environment
511 variable ``CONTAINER_PULL_REGISTRY`` and pushes new image into the
512 registry in the environment variable ``CONTAINER_PUSH_REGISTRY``.
513
514 :Template Names:
515
516     - {project-name}-maven-docker-stage-{stream}
517     - gerrit-maven-docker-stage
518     - github-maven-docker-stage
519
520 :Comment Trigger: "stage-release" or "stage-docker-release"
521
522 :Required parameters:
523
524     :container-public-registry: Docker registry source with base images.
525     :container-staging-registry: Docker registry target for the deploy action.
526
527 :Optional parameters:
528
529     :gerrit_release_docker_triggers: Override Gerrit Triggers.
530
531 All other required and optional parameters are identical to the Maven Stage job
532 described above.
533
534 .. _maven-sonar:
535
536 Maven Sonar
537 -----------
538
539 Sonar job which runs mvn clean install then publishes to Sonar.
540
541 This job purposely runs on the ``master`` branch and does not support
542 multi-branch configuration.
543
544 :Template Names:
545
546     - {project-name}-sonar
547     - gerrit-maven-sonar
548     - github-maven-sonar
549     - {project-name}-sonar-prescan-script
550     - gerrit-maven-sonar-prescan-script
551     - github-maven-sonar-prescan-script
552
553 :Comment Trigger: run-sonar
554
555 :Required parameters:
556
557     :build-node: The node to run build on.
558     :jenkins-ssh-credential: Credential to use for SSH. (Generally configured in defaults.yaml)
559     :mvn-settings: The name of settings file containing credentials for the project.
560     :sonar-prescan-script: (maven-sonar-prescan-script jobs) A shell script to run before
561         sonar scans.
562
563 :Optional parameters:
564
565     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
566     :build-timeout: Timeout in minutes before aborting build. (default: 60)
567     :cron: Cron schedule when to trigger the job. This parameter also
568         supports multiline input via YAML pipe | character in cases where
569         one may want to provide more than 1 cron timer.  (default: 'H H * * 6'
570         to run weekly)
571     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
572     :java-version: Version of Java to use for the Maven build. (default: openjdk11)
573     :mvn-global-settings: The name of the Maven global settings to use for
574         Maven configuration. (default: global-settings)
575     :mvn-goals: The maven goals to perform for the build.
576         (default: clean install)
577     :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
578     :mvn-params: Parameters to pass to the mvn CLI. (default: '')
579     :mvn-version: Version of maven to use. (default: mvn35)
580     :sonar-mvn-goals: Maven goals to run for sonar analysis.
581         (default: sonar:sonar)
582     :sonarcloud: Set to ``true`` to use SonarCloud ``true|false``.
583         (default: false)
584     :sonarcloud-project-key: SonarCloud project key. (default: '')
585     :sonarcloud-project-organization: SonarCloud project organization.
586         (default: '')
587     :sonarcloud-api-token-cred-id: Jenkins credential ID which has the SonarCloud API Token.
588         This one SHOULDN'T be overwritten as we are standarizing the credential ID for all
589         projects (default: 'sonarcloud-api-token')
590     :sonarcloud-java-version: Version of Java to use for the Sonar scan. (default: openjdk11)
591     :stream: Keyword that represents a release code-name.
592         Often the same as the branch. (default: master)
593     :submodule-recursive: Whether to checkout submodules recursively.
594         (default: true)
595     :submodule-timeout: Timeout (in minutes) for checkout operation.
596         (default: 10)
597     :submodule-disable: Disable submodule checkout operation.
598         (default: false)
599     :scan-dev-branch: Run the scan on a developer branch.
600         (default: false)
601
602     :gerrit_sonar_triggers: Override Gerrit Triggers.
603
604
605 SonarCloud Example:
606
607 .. literalinclude:: ../../.jjb-test/lf-maven-jobs/maven-sonarcloud.yaml
608    :language: yaml
609
610 Maven Sonar Verify
611 ------------------
612
613 Sonar job which runs mvn clean install then publishes to Sonar.
614
615 This job runs on dev branches and its triggered on new patchsets.
616
617 :Template Names:
618
619     - {project-name}-sonar-verify
620     - gerrit-maven-sonar-verify
621
622 :Comment Trigger: recheck|reverify
623
624 :Required parameters:
625
626     :build-node: The node to run build on.
627     :jenkins-ssh-credential: Credential to use for SSH. (Generally configured in defaults.yaml)
628     :mvn-settings: The name of settings file containing credentials for the project.
629
630 :Optional parameters:
631
632     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
633     :build-timeout: Timeout in minutes before aborting build. (default: 60)
634     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
635     :java-version: Version of Java to use for the Maven build. (default: openjdk11)
636     :mvn-global-settings: The name of the Maven global settings to use for
637         Maven configuration. (default: global-settings)
638     :mvn-goals: The maven goals to perform for the build.
639         (default: clean install)
640     :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
641     :mvn-params: Parameters to pass to the mvn CLI. (default: '')
642     :mvn-version: Version of maven to use. (default: mvn35)
643     :pre-build-script: Shell script to run before maven build. (default: a string with a shell comment)
644     :post-build-script: Shell script to run after maven build. (default: a string with a shell comment)
645     :sonar-mvn-goal: Maven goals to run for sonar analysis.
646         (default: sonar:sonar)
647     :sonarcloud: Set to ``true`` to use SonarCloud ``true|false``.
648         (default: true)
649     :sonarcloud-project-key: SonarCloud project key. (default: '')
650     :sonarcloud-project-organization: SonarCloud project organization.
651         (default: '')
652     :sonarcloud-api-token-cred-id: Jenkins credential ID which has the SonarCloud API Token.
653         This one SHOULDN'T be overwritten as we are standarizing the credential ID for all
654         projects (default: 'sonarcloud-api-token')
655     :sonarcloud-java-version: Version of Java to use for the Sonar scan. (default: openjdk11)
656     :sonarcloud-qualitygate-wait: SonarCloud flag that forces the analysis step to
657         wait for the quality gate result. (default: false)
658     :stream: Keyword that represents a release code-name.
659         Often the same as the branch. (default: master)
660     :submodule-recursive: Whether to checkout submodules recursively.
661         (default: true)
662     :submodule-timeout: Timeout (in minutes) for checkout operation.
663         (default: 10)
664     :submodule-disable: Disable submodule checkout operation.
665         (default: false)
666     :scan-dev-branch: Run the scan on a developer branch.
667         (default: true)
668
669     :gerrit_sonar_triggers: Override Gerrit Triggers.
670
671
672 SonarCloud Example:
673
674 .. literalinclude:: ../../.jjb-test/lf-maven-jobs/maven-sonarcloud.yaml
675    :language: yaml
676
677 Maven Verify
678 ------------
679
680 Verify job which runs mvn clean install to test a project build..
681
682 :Template Names:
683
684     - {project-name}-maven-verify-{stream}-{mvn-version}-{java-version}
685     - gerrit-maven-verify
686     - github-maven-verify
687
688 :Comment Trigger: recheck|reverify
689
690 :Required parameters:
691
692     :build-node: The node to run build on.
693     :jenkins-ssh-credential: Credential to use for SSH. (Generally configured in defaults.yaml)
694     :mvn-settings: The name of settings file containing credentials for the project.
695
696 :Optional parameters:
697
698     :branch: Git branch to fetch for the build. (default: master)
699     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
700     :build-timeout: Timeout in minutes before aborting build. (default: 60)
701     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
702     :java-version: Version of Java to use for the build. (default: openjdk11)
703     :mvn-global-settings: The name of the Maven global settings to use for
704         Maven configuration. (default: global-settings)
705     :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
706     :mvn-params: Parameters to pass to the mvn CLI. (default: '')
707     :mvn-version: Version of maven to use. (default: mvn35)
708     :stream: Keyword that represents a release code-name.
709         Often the same as the branch. (default: master)
710     :submodule-recursive: Whether to checkout submodules recursively.
711         (default: true)
712     :submodule-timeout: Timeout (in minutes) for checkout operation.
713         (default: 10)
714     :submodule-disable: Disable submodule checkout operation.
715         (default: false)
716
717     :gerrit_verify_triggers: Override Gerrit Triggers.
718     :gerrit_trigger_file_paths: Override file paths to filter which file
719         modifications will trigger a build.
720
721 Maven Verify for Docker
722 -----------------------
723
724 Like the Maven Verify job as described above but logs in to Docker
725 registries first. The project POM file should invoke a plugin to build
726 a Docker image. This pulls the base image from the registry in the environment
727 variable ``CONTAINER_PULL_REGISTRY``.
728
729 :Template Names:
730
731     - {project-name}-maven-docker-verify-{stream}-{mvn-version}-{java-version}
732     - gerrit-maven-docker-verify
733     - github-maven-docker-verify
734
735 :Required parameters:
736
737     :container-public-registry: Docker registry source with base images.
738
739 All other required and optional parameters are identical to the Maven Verify job
740 described above.
741
742 Maven Verify w/ Dependencies
743 ----------------------------
744
745 Verify job which runs mvn clean install to test a project build /w deps
746
747 This job's purpose is to verify a patch in conjunction to a list of upstream
748 patches it depends on. The user of this job can provide a list of patches via
749 comment trigger.
750
751 :Template Names:
752
753     - {project-name}-maven-verify-deps-{stream}-{mvn-version}-{java-version}
754     - gerrit-maven-verify-dependencies
755
756 :Comment Trigger: recheck: SPACE_SEPARATED_LIST_OF_PATCHES
757
758 :Required parameters:
759
760     :build-node: The node to run build on.
761     :jenkins-ssh-credential: Credential to use for SSH. (Generally configured in defaults.yaml)
762     :mvn-settings: The name of settings file containing credentials for the project.
763
764 :Optional parameters:
765
766     :branch: Git branch to fetch for the build. (default: master)
767     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
768     :build-timeout: Timeout in minutes before aborting build. (default: 60)
769     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
770     :java-version: Version of Java to use for the build. (default: openjdk11)
771     :mvn-global-settings: The name of the Maven global settings to use for
772         Maven configuration. (default: global-settings)
773     :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
774     :mvn-params: Parameters to pass to the mvn CLI. (default: '')
775     :mvn-version: Version of maven to use. (default: mvn35)
776     :stream: Keyword that represents a release code-name.
777         Often the same as the branch. (default: master)
778     :submodule-recursive: Whether to checkout submodules recursively.
779         (default: true)
780     :submodule-timeout: Timeout (in minutes) for checkout operation.
781         (default: 10)
782     :submodule-disable: Disable submodule checkout operation.
783         (default: false)
784
785     :gerrit_verify_triggers: Override Gerrit Triggers.
786     :gerrit_trigger_file_paths: Override file paths to filter which file
787         modifications will trigger a build.