ccd4165211ad721918fdfc8624e2631c853de505
[releng/global-jjb.git] / docs / jjb / lf-maven-jobs.rst
1 ##########
2 Maven Jobs
3 ##########
4
5 Job Groups
6 ==========
7
8 {project-name}-maven-jobs
9 -------------------------
10
11 Jobs for Maven projects using Gerrit.
12
13 :Includes:
14
15     - gerrit-maven-clm
16     - gerrit-maven-release
17     - gerrit-maven-verify
18     - gerrit-maven-verify-dependencies
19
20 {project-name}-github-maven-jobs
21 --------------------------------
22
23 Jobs for Maven projects using GitHub.
24
25 :Includes:
26
27     - github-maven-clm
28     - github-maven-release
29     - github-maven-verify
30
31 {project-name}-maven-javadoc-jobs
32 ---------------------------------
33
34 Jobs for Maven projects to generate javadoc using Gerrit.
35
36 :Includes:
37
38     - gerrit-maven-javadoc-publish
39     - gerrit-maven-javadoc-verify
40
41 {project-name}-github-maven-javadoc-jobs
42 ----------------------------------------
43
44 Jobs for Maven projects to generate javadoc using GitHub.
45
46 :Includes:
47
48     - github-maven-javadoc-publish
49     - github-maven-javadoc-verify
50
51
52 Macros
53 ======
54
55 lf-infra-maven-sonar
56 --------------------
57
58 Runs Sonar against a Maven project.
59
60 :Required Parameters:
61
62     :java-version: Version of Java to execute Sonar with.
63     :mvn-version: Version of Maven to execute Sonar with.
64     :mvn-settings: Maven settings.xml file containing credentials to use.
65
66 lf-maven-build
67 --------------
68
69 Calls the maven build script to perform a maven build.
70
71 :Required parameters:
72
73     :mvn-goals: The maven goals to perform for the build.
74         (default: clean deploy)
75
76 lf-maven-common
77 ---------------
78
79 Common Jenkins configuration for Maven jobs.
80
81 lf-maven-deploy
82 ---------------
83
84 Calls the maven deploy script to push artifacts to Nexus.
85
86 lf-maven-stage
87 ---------------
88
89 Calls the maven stage script to push artifacts to a Nexus staging repository.
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. openjdk8
100
101 Job Templates
102 =============
103
104 Maven CLM
105 ---------
106
107 Produces a CLM scan of the code into Nexus IQ Server.
108
109 :Template Names:
110
111     - {project-name}-maven-clm-{stream}
112     - gerrit-maven-clm
113     - github-maven-clm
114
115 :Required parameters:
116
117     :build-node:    The node to run build on.
118     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
119         be configured in defaults.yaml)
120     :mvn-settings: The name of settings file containing credentials for the project.
121
122 :Optional parameters:
123
124     :branch: The branch to build against. (default: master)
125     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
126     :build-timeout: Timeout in minutes before aborting build. (default: 60)
127     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
128     :java-version: Version of Java to use for the build. (default: openjdk8)
129     :mvn-global-settings: The name of the Maven global settings to use for
130         Maven configuration. (default: global-settings)
131     :mvn-opts: Sets MAVEN_OPTS. (default: '')
132     :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
133     :mvn-version: Version of maven to use. (default: mvn35)
134     :nexus-iq-stage: Stage the policy evaluation will be run against on
135         the Nexus IQ Server. (default: 'build')
136     :stream: Keyword that can be used to represent a release code-name.
137         Often the same as the branch. (default: master)
138     :submodule-recursive: Whether to checkout submodules recursively.
139         (default: true)
140
141     :gerrit_merge_triggers: Override Gerrit Triggers.
142
143 Maven JavaDoc Publish
144 ---------------------
145
146 Produces and publishes javadocs for a Maven project.
147
148 Expects javadocs to be available in $WORKSPACE/target/site/apidocs
149
150 :Template Names:
151
152     - {project-name}-maven-javadoc-publish-{stream}
153     - gerrit-maven-javadoc-publish
154     - github-maven-javadoc-publish
155
156 :Required parameters:
157
158     :build-node: The node to run build on.
159     :javadoc-path: The path in Nexus to deploy javadoc to.
160     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
161         be configured in defaults.yaml)
162     :mvn-settings: The name of settings file containing credentials for the project.
163     :mvn-site-id: Maven Server ID from settings.xml to pull credentials from.
164         (Note: This setting should be configured in defaults.yaml.)
165
166 :Optional parameters:
167
168     :branch: The branch to build against. (default: master)
169     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
170     :build-timeout: Timeout in minutes before aborting build. (default: 60)
171     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
172     :java-version: Version of Java to use for the build. (default: openjdk8)
173     :mvn-global-settings: The name of the Maven global settings to use for
174         Maven configuration. (default: global-settings)
175     :mvn-opts: Sets MAVEN_OPTS. (default: '')
176     :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
177     :mvn-version: Version of maven to use. (default: mvn35)
178     :stream: Keyword that can be used to represent a release code-name.
179         Often the same as the branch. (default: master)
180     :submodule-recursive: Whether to checkout submodules recursively.
181         (default: true)
182
183     :gerrit_merge_triggers: Override Gerrit Triggers.
184
185 Maven JavaDoc Verify
186 --------------------
187
188 Produces javadocs for a Maven project.
189
190 Expects javadocs to be available in $WORKSPACE/target/site/apidocs
191
192 :Template Names:
193
194     - {project-name}-maven-javadoc-verify-{stream}
195     - gerrit-maven-javadoc-verify
196     - github-maven-javadoc-verify
197
198 :Required parameters:
199     :build-node:    The node to run build on.
200     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
201         be configured in defaults.yaml)
202     :mvn-settings: The name of settings file containing credentials for the project.
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     :deploy-path:    The path in Nexus to deploy javadoc to. (default: $PROJECT/$STREAM)
210     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
211     :java-version: Version of Java to use for the build. (default: openjdk8)
212     :mvn-global-settings: The name of the Maven global settings to use for
213         Maven configuration. (default: global-settings)
214     :mvn-opts: Sets MAVEN_OPTS. (default: '')
215     :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
216     :mvn-version: Version of maven to use. (default: mvn35)
217     :stream: Keyword that can be used to represent a release code-name.
218         Often the same as the branch. (default: master)
219     :submodule-recursive: Whether to checkout submodules recursively.
220         (default: true)
221
222     :gerrit_verify_triggers: Override Gerrit Triggers.
223
224 Maven Merge
225 -----------
226
227 Merge job which runs `mvn clean deploy` to build a project.
228
229 This job pushes files to Nexus using cURL instead of allowing the Maven deploy
230 goal to push the upload. This is to get around the issue that Maven deploy does
231 not properly support uploading files at the end of the build and instead pushes
232 as it goes. There exists a `-Ddeploy-at-end` feature however it does not work
233 with extensions.
234
235 This job uses the following strategy to deploy jobs to Nexus:
236
237 1. `wget -r` to fetch maven-metadata.xml from Nexus
238 2. `mvn deploy -DaltDeploymentRepository` to prepare files for upload
239 3. Removes untouched maven-metadata.xml files before upload
240 4. Use lftools (cURL) upload script to push artifacts to Nexus
241
242 :Template Names:
243
244     - {project-name}-maven-merge-{stream}
245     - gerrit-maven-merge
246     - github-maven-merge
247
248 :Required parameters:
249
250     :build-node: The node to run build on.
251     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
252         be configured in defaults.yaml)
253     :mvn-settings: The name of settings file containing credentials for the project.
254     :mvn-snapshot-id: Maven Server ID from settings.xml to pull credentials from.
255         (Note: This setting should be configured in defaults.yaml.)
256     :nexus-snapshot-repo: The repository id of the Nexus snapshot repo to deploy to.
257
258 :Optional parameters:
259
260     :branch: Git branch to fetch for the build. (default: master)
261     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
262     :build-timeout: Timeout in minutes before aborting build. (default: 60)
263     :cron: Cron schedule when to trigger the job. This parameter also
264         supports multiline input via YAML pipe | character in cases where
265         one may want to provide more than 1 cron timer. (default: 'H H * * 0'
266         to run weekly)
267     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
268     :java-version: Version of Java to use for the build. (default: openjdk8)
269     :mvn-global-settings: The name of the Maven global settings to use for
270         Maven configuration. (default: global-settings)
271     :mvn-opts: Sets MAVEN_OPTS. (default: '')
272     :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
273     :mvn-version: Version of maven to use. (default: mvn35)
274     :nexus-cut-dirs: Number of directories to cut from file path for `wget -r`.
275     :stream: Keyword that can be used to represent a release code-name.
276         Often the same as the branch. (default: master)
277     :submodule-recursive: Whether to checkout submodules recursively.
278         (default: true)
279
280     :gerrit_merge_triggers: Override Gerrit Triggers.
281     :gerrit_trigger_file_paths: Override file paths which can be used to
282         filter which file modifications will trigger a build.
283
284 Maven Release
285 -------------
286
287 Produces a release candidate by creating a staging repo in Nexus.
288
289 Runs a Maven build and deploys to $WORKSPACE/m2repo directory. This
290 directory can then be reused later to deploy to Nexus.
291
292 :Template Names:
293
294     - {project-name}-maven-release-{stream}
295     - gerrit-maven-release
296     - github-maven-release
297
298 :Required parameters:
299
300     :build-node: The node to run build on.
301     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
302         be configured in defaults.yaml)
303     :mvn-settings: The name of settings file containing credentials for the project.
304     :mvn-staging-id: Maven Server ID from settings.xml to pull credentials from.
305         (Note: This setting should be configured in defaults.yaml.)
306     :staging-profile-id: Profile ID of the project's Nexus staging profile.
307
308 :Optional parameters:
309
310     :archive-artifacts: Artifacts to archive to the logs server (default: '').
311     :branch: The branch to build against. (default: master)
312     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
313     :build-timeout: Timeout in minutes before aborting build. (default: 60)
314     :cron: Cron schedule when to trigger the job. This parameter also
315         supports multiline input via YAML pipe | character in cases where
316         one may want to provide more than 1 cron timer. (default: '')
317     :deploy-path:    The path in Nexus to deploy javadoc to. (default: $PROJECT/$STREAM)
318     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
319     :java-version: Version of Java to use for the build. (default: openjdk8)
320     :mvn-global-settings: The name of the Maven global settings to use for
321         Maven configuration. (default: global-settings)
322     :mvn-opts: Sets MAVEN_OPTS. (default: '')
323     :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
324     :mvn-version: Version of maven to use. (default: mvn35)
325     :stream: Keyword that can be used to represent a release code-name.
326         Often the same as the branch. (default: master)
327     :submodule-recursive: Whether to checkout submodules recursively.
328         (default: true)
329
330     :gerrit_release_triggers: Override Gerrit Triggers.
331
332 Maven Sonar
333 -----------
334
335 Sonar job which runs mvn clean install then publishes to Sonar.
336
337 This job purposely only runs on the master branch as there are Additional
338 configuration needed to support multiple branches and there's not much
339 interest in that kind of support.
340
341 :Template Names:
342
343     - {project-name}-sonar
344     - gerrit-maven-sonar
345     - github-maven-sonar
346
347 :Required parameters:
348
349     :build-node: The node to run build on.
350     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
351         be configured in defaults.yaml)
352     :mvn-settings: The name of settings file containing credentials for the project.
353
354 :Optional parameters:
355
356     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
357     :build-timeout: Timeout in minutes before aborting build. (default: 60)
358     :cron: Cron schedule when to trigger the job. This parameter also
359         supports multiline input via YAML pipe | character in cases where
360         one may want to provide more than 1 cron timer.  (default: 'H H * * 6'
361         to run weekly)
362     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
363     :java-version: Version of Java to use for the build. (default: openjdk8)
364     :mvn-global-settings: The name of the Maven global settings to use for
365         Maven configuration. (default: global-settings)
366     :mvn-opts: Sets MAVEN_OPTS. (default: '')
367     :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
368     :mvn-version: Version of maven to use. (default: mvn35)
369     :stream: Keyword that can be used to represent a release code-name.
370         Often the same as the branch. (default: master)
371     :submodule-recursive: Whether to checkout submodules recursively.
372         (default: true)
373
374     :gerrit_sonar_triggers: Override Gerrit Triggers.
375
376 Maven Verify
377 ------------
378
379 Verify job which runs mvn clean install to test a project build..
380
381 :Template Names:
382
383     - {project-name}-maven-verify-{stream}-{mvn-version}-{java-version}
384     - gerrit-maven-verify
385     - github-maven-verify
386
387 :Required parameters:
388
389     :build-node: The node to run build on.
390     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
391         be configured in defaults.yaml)
392     :mvn-settings: The name of settings file containing credentials for the project.
393
394 :Optional parameters:
395
396     :branch: Git branch to fetch for the build. (default: master)
397     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
398     :build-timeout: Timeout in minutes before aborting build. (default: 60)
399     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
400     :java-version: Version of Java to use for the build. (default: openjdk8)
401     :mvn-global-settings: The name of the Maven global settings to use for
402         Maven configuration. (default: global-settings)
403     :mvn-opts: Sets MAVEN_OPTS. (default: '')
404     :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
405     :mvn-version: Version of maven to use. (default: mvn35)
406     :stream: Keyword that can be used to represent a release code-name.
407         Often the same as the branch. (default: master)
408     :submodule-recursive: Whether to checkout submodules recursively.
409         (default: true)
410
411     :gerrit_verify_triggers: Override Gerrit Triggers.
412     :gerrit_trigger_file_paths: Override file paths which can be used to
413         filter which file modifications will trigger a build.
414
415 Maven Verify /w Dependencies
416 ----------------------------
417
418 Verify job which runs mvn clean install to test a project build /w deps
419
420 This job can be used to verify a patch in conjunction to all of the
421 upstream patches it depends on. The user of this job can provide a list
422 via comment trigger.
423
424 :Template Names:
425
426     - {project-name}-maven-verify-deps-{stream}-{mvn-version}-{java-version}
427     - gerrit-maven-verify-dependencies
428
429 :Comment Trigger: recheck: SPACE_SEPERATED_LIST_OF_PATCHES
430
431 :Required parameters:
432
433     :build-node: The node to run build on.
434     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
435         be configured in defaults.yaml)
436     :mvn-settings: The name of settings file containing credentials for the project.
437
438 :Optional parameters:
439
440     :branch: Git branch to fetch for the build. (default: master)
441     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
442     :build-timeout: Timeout in minutes before aborting build. (default: 60)
443     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
444     :java-version: Version of Java to use for the build. (default: openjdk8)
445     :mvn-global-settings: The name of the Maven global settings to use for
446         Maven configuration. (default: global-settings)
447     :mvn-opts: Sets MAVEN_OPTS. (default: '')
448     :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
449     :mvn-version: Version of maven to use. (default: mvn35)
450     :stream: Keyword that can be used to represent a release code-name.
451         Often the same as the branch. (default: master)
452     :submodule-recursive: Whether to checkout submodules recursively.
453         (default: true)
454
455     :gerrit_verify_triggers: Override Gerrit Triggers.
456     :gerrit_trigger_file_paths: Override file paths which can be used to
457         filter which file modifications will trigger a build.