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