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