Merge "Make autorelease run validation on patch submit"
[releng/builder.git] / jjb / releng-templates-java.yaml
1 ---
2 - job-template:
3     # Template used for running CLM scans
4     # Arguements:
5     #   {name}         - Project Shortname
6     #   {project}      - Fully qualified project name
7     #   {mvn-settings} - Project maven settings file
8     #   {stream}
9     #   {jdk}
10     name: '{project-name}-clm-{stream}'
11
12     project-type: freestyle
13     node: '{build-node}'
14     jdk: '{jdk}'
15
16     properties:
17       - opendaylight-infra-properties:
18           build-days-to-keep: '{build-days-to-keep}'
19
20     parameters:
21       - opendaylight-infra-parameters:
22           os-cloud: '{os-cloud}'
23           project: '{project}'
24           branch: '{branch}'
25           refspec: 'refs/heads/{branch}'
26           artifacts: '{archive-artifacts}'
27
28     scm:
29       - git-scm:
30           refspec: ''
31           branch: '{branch}'
32
33     wrappers:
34       - opendaylight-infra-wrappers:
35           build-timeout: '{build-timeout}'
36
37     triggers:
38       - timed: 'H H * * 6'
39
40     builders:
41       - provide-maven-settings:
42           global-settings-file: 'global-settings'
43           settings-file: '{mvn-settings}'
44       - maven-target:
45           maven-version: 'mvn33'
46           pom: 'pom.xml'
47           goals: |
48               clean install dependency:tree com.sonatype.clm:clm-maven-plugin:index
49               -Pq
50               {opendaylight-infra-mvn-opts}
51           java-opts:
52             - '-Xmx4096m -XX:MaxPermSize=512m'
53           settings: '{mvn-settings}'
54           settings-type: cfp
55           global-settings: 'global-settings'
56           global-settings-type: cfp
57       - shell: 'find . -regex ".*karaf/target" | xargs rm -rf'
58       - check-clm:
59           application-name: '{project-name}'
60
61     publishers:
62       - email-notification:
63           email-recipients: '{email-recipients}'
64           email-prefix: '[{project-name}]'
65       - lf-infra-publish
66
67 - job-template:
68     name: '{project-name}-integration-{stream}'
69
70     # Job template for ODL integration verify jobs
71     #
72     # This is similar to a normal verify job, but it runs
73     # when a project that's a dependency of your project
74     # is successfully built.
75     #
76     # Required Variables:
77     #     stream:    release stream (eg. boron or carbon)
78     #     branch:    git branch (eg. stable/boron or master)
79
80     project-type: freestyle
81     node: '{build-node}'
82     jdk: '{jdk}'
83
84     properties:
85       - opendaylight-infra-properties:
86           build-days-to-keep: '{build-days-to-keep}'
87
88     parameters:
89       - opendaylight-infra-parameters:
90           os-cloud: '{os-cloud}'
91           project: '{project}'
92           branch: '{branch}'
93           refspec: 'refs/heads/{branch}'
94           artifacts: '{archive-artifacts}'
95
96     scm:
97       - git-scm:
98           refspec: ''
99           branch: '{branch}'
100
101     wrappers:
102       - opendaylight-infra-wrappers:
103           build-timeout: '{build-timeout}'
104
105     triggers:
106       - reverse:
107           jobs: '{dependencies}'
108           result: 'success'
109
110     builders:
111       - jacoco-nojava-workaround
112       - provide-maven-settings:
113           global-settings-file: 'global-settings'
114           settings-file: '{mvn-settings}'
115       - maven-target:
116           maven-version: 'mvn33'
117           goals: |
118               {mvn-goals}
119               {opendaylight-infra-mvn-opts}
120           java-opts:
121             - '{mvn-opts}'
122           settings: '{mvn-settings}'
123           settings-type: cfp
124           global-settings: 'global-settings'
125           global-settings-type: cfp
126
127     publishers:
128       - email-notification:
129           email-recipients: '{email-recipients}'
130           email-prefix: '{email-upstream}'
131       - findbugs
132       - jacoco-report
133       - lf-infra-publish
134
135 - job-template:
136     name: '{project-name}-merge-{stream}'
137
138     # Job template for ODL merge jobs
139     #
140     # The purpose of this job template is to setup a ODL merge job
141     # and deploy artifacts to Nexus.
142     #
143     # Required Variables:
144     #     stream:    release stream (eg. boron or carbon)
145     #     branch:    git branch (eg. stable/boron or master)
146
147     # Need to keep jobs that deploy to Nexus at end of build as Maven
148     # projects. Maybe reconsider this once upstream moves deploy to a
149     # separate lifecycle:
150     #     https://issues.apache.org/jira/browse/MNG-5666
151     project-type: maven
152     node: '{build-node}'
153     jdk: '{jdk}'
154
155     properties:
156       - opendaylight-infra-properties:
157           build-days-to-keep: 14
158
159     parameters:
160       - opendaylight-infra-parameters:
161           os-cloud: '{os-cloud}'
162           project: '{project}'
163           branch: '{branch}'
164           refspec: 'refs/heads/{branch}'
165           artifacts: '{archive-artifacts}'
166       - string:
167           name: STREAM
168           default: '{stream}'
169           description: "String representing release name"
170
171     scm:
172       - gerrit-trigger-scm:
173           refspec: ''
174           choosing-strategy: 'default'
175
176     wrappers:
177       - opendaylight-infra-wrappers:
178           build-timeout: '{build-timeout}'
179
180     triggers:
181       - timed: 'H H * * 0'
182       - gerrit-trigger-patch-merged:
183           server-name: '{server-name}'
184           name: '{project}'
185           branch: '{branch}'
186
187     prebuilders:
188       - jacoco-nojava-workaround
189       - provide-maven-settings:
190           global-settings-file: 'global-settings'
191           settings-file: '{mvn-settings}'
192
193     # TODO: Do we want to apply sophisticated checks as in *-distribution-check-*?
194     maven:
195       maven-name: 'mvn33'
196       goals: >
197           {mvn-goals}
198           -Dmerge
199           -Dstream={stream}
200           {opendaylight-infra-mvn-opts}
201       maven-opts: '{mvn-opts}'
202       settings: '{mvn-settings}'
203       settings-type: cfp
204       global-settings: 'global-settings'
205       global-settings-type: cfp
206       post-step-run-condition: UNSTABLE
207
208     postbuilders:
209       - conditional-step:
210           condition-kind: file-exists
211           condition-filename: deploy-site.xml
212           condition-basedir: workspace
213
214           # The strategy here is intentional to run Maven site:deploy twice
215           # once using regular pom.xml to produce a staged-site which is
216           # then used by deploy-site.xml to push to Nexus. This is a
217           # workaround to Maven Site's default linking code which creates
218           # incorrect URLs for sites due to auto-detection assuming your
219           # project is configured in a certain way which ODL is not.
220           steps:
221             - maven-target:
222                 maven-version: 'mvn33'
223                 pom: pom.xml
224                 goals: 'site:deploy -V -B -Dstream={stream}'
225                 java-opts:
226                   - '-Xmx2g'
227                 settings: '{mvn-settings}'
228                 settings-type: cfp
229                 global-settings: 'global-settings'
230                 global-settings-type: cfp
231             - opendaylight-infra-deploy-maven-site:
232                 settings-file: '{mvn-settings}'
233
234     reporters:
235       - findbugs
236
237     publishers:
238       - email-notification:
239           email-recipients: '{email-recipients}'
240           email-prefix: '[{project-name}]'
241       - maven-deploy:
242           id: ''
243           unique-version: true
244           deploy-unstable: false
245       - jacoco-report
246       - lf-infra-publish
247       - trigger:
248           project: 'distribution-merge-{stream}'
249           threshold: SUCCESS
250
251 - job-template:
252     name: '{project-name}-sonar'
253     disabled: false
254
255     project-type: freestyle
256     node: '{build-node}'
257     jdk: 'openjdk8'
258
259     properties:
260       - opendaylight-infra-properties:
261           build-days-to-keep: 7
262
263     parameters:
264       - opendaylight-infra-parameters:
265           os-cloud: '{os-cloud}'
266           project: '{project}'
267           branch: '{branch}'
268           refspec: 'refs/heads/{branch}'
269           artifacts: '{archive-artifacts}'
270
271     scm:
272       - git-scm:
273           refspec: ''
274           branch: 'master'
275
276     wrappers:
277       - opendaylight-infra-wrappers:
278           build-timeout: '{build-timeout}'
279
280     triggers:
281       - timed: 'H H * * 6'
282       - gerrit-trigger-patch-sonar:
283           server-name: '{server-name}'
284           name: '{project}'
285           # FIXME: Make sure this does not alter Gerrit votes, then update docs.
286
287     builders:
288       - jacoco-nojava-workaround
289       - provide-maven-settings:
290           global-settings-file: 'global-settings'
291           settings-file: '{mvn-settings}'
292       - maven-target:
293           maven-version: 'mvn33'
294           goals: |
295               {mvn-goals}
296               -Dsonar
297               {opendaylight-infra-mvn-opts}
298           maven-opts:
299             - '{mvn-opts}'
300           settings: '{mvn-settings}'
301           settings-type: cfp
302           global-settings: 'global-settings'
303           global-settings-type: cfp
304       - maven-target:
305           maven-version: 'mvn33'
306           # We should switch to the recommended configuration of sonar once
307           # JJB adds support for configurating the Sonar wrapper:
308           #    http://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Jenkins
309           goals: |
310               sonar:sonar
311               -Dsonar
312               -Dsonar.host.url=https://sonar.opendaylight.org
313               {opendaylight-infra-mvn-opts}
314           maven-opts:
315             - '{mvn-opts}'
316           settings: '{mvn-settings}'
317           settings-type: cfp
318           global-settings: 'global-settings'
319           global-settings-type: cfp
320
321     publishers:
322       - email-notification:
323           email-recipients: '{email-recipients}'
324           email-prefix: '[{project-name}]'
325       - jacoco-report
326       - findbugs
327       - lf-infra-publish
328
329 - job-template:
330     name: '{project-name}-validate-autorelease-{stream}'
331     disabled: false
332
333     project-type: freestyle
334     node: '{build-node}'
335     concurrent: true
336     jdk: '{jdk}'
337
338     properties:
339       - opendaylight-infra-properties:
340           build-days-to-keep: 7
341
342     parameters:
343       - opendaylight-infra-parameters:
344           os-cloud: '{os-cloud}'
345           project: '{project}'
346           branch: '{branch}'
347           refspec: 'refs/heads/{branch}'
348           artifacts: '{archive-artifacts}'
349       - autorelease-release-tag:
350           release-tag: 'validate'
351       - autorelease-release-branch:
352           release-branch: '{branch}'
353       - string:
354           name: CLONE_URL
355           default: '{git-url}/releng/autorelease'
356           description: "Autorelease clone URL"
357
358     scm:
359       - git:
360           url: '$CLONE_URL'
361           credentials-id: 'opendaylight-jenkins-ssh'
362           refspec: ''
363           branches:
364             - 'origin/{branch}'
365           skip-tag: true
366           submodule:
367             recursive: true
368             timeout: 60
369
370     wrappers:
371       - opendaylight-infra-wrappers:
372           build-timeout: '{build-timeout}'
373
374     triggers:
375       - gerrit-trigger-patch-submitted:
376           server: '{server-name}'
377           project: '{project}'
378           branch: '{branch}'
379           files: '**/*.xml'
380
381     builders:
382       - jacoco-nojava-workaround
383       - autorelease-checkout-gerrit-patch
384       - autorelease-generate-release-patches
385       # In a perfect world projects should be releasing separately and we consume them
386       # via a project that pulls the release bits from each project from Nexus.
387       # Keep the patches compatible with that ideal, but apply an edit
388       # to enable building in a single maven reactor afterwards.
389       - autorelease-fix-relative-paths
390       - maven-target:
391           maven-version: 'mvn33'
392           pom: validate-pom.xml
393           goals: |
394               clean install dependency:tree
395               -T1.5C
396               -Pq
397               {opendaylight-infra-mvn-opts}
398           java-opts:
399             - '-Xmx8g'
400           settings: 'autorelease-settings'
401           settings-type: cfp
402           global-settings: 'global-settings'
403           global-settings-type: cfp
404       - maven-target:
405           maven-version: 'mvn33'
406           pom: 'pom.xml'
407           goals: |
408               clean validate
409               -Pq
410               {opendaylight-infra-mvn-opts}
411           java-opts:
412             - '-Xmx8g -XX:MaxPermSize=1024m -Dmaven.compile.fork=true'
413           settings: 'autorelease-settings'
414           settings-type: cfp
415           global-settings: 'global-settings'
416           global-settings-type: cfp
417
418     publishers:
419       - email-notification:
420           email-recipients: '{email-recipients}'
421           email-prefix: '[autorelease] [{project-name}]'
422       - lf-infra-publish
423
424 - job-template:
425     name: '{project-name}-verify-{stream}-{maven}-{jdks}'
426
427     # Job template for ODL verify jobs
428     #
429     # The purpose of this job template is to setup a ODL verify job
430     #
431     # Required Variables:
432     #     stream:    release stream (eg. boron or carbon)
433     #     branch:    git branch (eg. stable/boron or master)
434
435     project-type: freestyle
436     node: '{build-node}'
437     concurrent: true
438     jdk: '{jdks}'
439
440     properties:
441       - opendaylight-infra-properties:
442           build-days-to-keep: 7
443
444     parameters:
445       - opendaylight-infra-parameters:
446           os-cloud: '{os-cloud}'
447           project: '{project}'
448           branch: '{branch}'
449           refspec: 'refs/heads/{branch}'
450           artifacts: '{archive-artifacts}'
451
452     scm:
453       - gerrit-trigger-scm:
454           refspec: '$GERRIT_REFSPEC'
455           choosing-strategy: 'gerrit'
456
457     wrappers:
458       - opendaylight-infra-wrappers:
459           build-timeout: '{build-timeout}'
460
461     triggers:
462       - gerrit-trigger-patch-submitted:
463           server: '{server-name}'
464           project: '{project}'
465           branch: '{branch}'
466           files: '**'
467
468     builders:
469       - jacoco-nojava-workaround
470       - provide-maven-settings:
471           global-settings-file: 'global-settings'
472           settings-file: '{mvn-settings}'
473       - maven-target:
474           maven-version: '{mvn-version}'
475           goals: |
476               {mvn-goals}
477               -Dstream={stream}
478               {opendaylight-infra-mvn-opts}
479           java-opts:
480             - '{mvn-opts}'
481           settings: '{mvn-settings}'
482           settings-type: cfp
483           global-settings: 'global-settings'
484           global-settings-type: cfp
485
486     publishers:
487       - findbugs
488       - email-notification:
489           email-recipients: '{email-recipients}'
490           email-prefix: '[{project-name}]'
491       - jacoco-report
492       - lf-infra-publish