Put link to current job into distribution
[releng/builder.git] / jjb / releng-templates-java.yaml
1 - job-template:
2     # Template used for running CLM scans
3     # Arguements:
4     #   {name}         - Project Shortname
5     #   {project}      - Fully qualified project name
6     #   {mvn-settings} - Project maven settings file
7     #   {stream}
8     #   {jdk}
9     name: '{project-name}-clm-{stream}'
10
11     project-type: freestyle
12     node: '{build-node}'
13     jdk: '{jdk}'
14
15     properties:
16         - opendaylight-infra-properties:
17             build-days-to-keep: '{build-days-to-keep}'
18
19     parameters:
20         - opendaylight-infra-parameters:
21             project: '{project}'
22             branch: '{branch}'
23             refspec: 'refs/heads/{branch}'
24             artifacts: '{archive-artifacts}'
25
26     scm:
27         - git-scm:
28             refspec: ''
29             branch: '{branch}'
30
31     wrappers:
32         - opendaylight-infra-wrappers:
33             build-timeout: '{build-timeout}'
34
35     triggers:
36         - timed: 'H H * * 6'
37
38     builders:
39         - provide-maven-settings:
40             global-settings-file: 'odl-global-settings'
41             settings-file: '{mvn-settings}'
42         - maven-target:
43             maven-version: 'mvn33'
44             pom: 'pom.xml'
45             goals: 'clean install dependency:tree com.sonatype.clm:clm-maven-plugin:index -V -B -Pq -Djenkins -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r'
46             java-opts:
47               - '-Xmx4096m -XX:MaxPermSize=512m'
48             settings: '{mvn-settings}'
49             settings-type: cfp
50             global-settings: 'odl-global-settings'
51             global-settings-type: cfp
52         - shell: 'find . -regex ".*karaf/target" | xargs rm -rf'
53         - check-clm:
54             application-name: '{project-name}'
55
56     publishers:
57         - email-notification:
58             email-recipients: '{email-recipients}'
59             email-prefix: '[{project-name}]'
60         - opendaylight-infra-shiplogs:
61             maven-version: 'mvn33'
62
63 - job-template:
64     name: '{project-name}-distribution-{stream}'
65
66     # Required variables:
67     #     stream:    release stream (eg. boron or carbon)
68     #     branch:    git branch (eg. stable/boron or master)
69
70     # Need to keep jobs that deploy to Nexus at end of build as Maven
71     # projects. Maybe reconsider this once upstream moves deploy to a
72     # separate lifecycle:
73     #     https://issues.apache.org/jira/browse/MNG-5666
74     project-type: maven
75     node: '{build-node}'
76     jdk: '{jdk}'
77
78     properties:
79         - opendaylight-infra-properties:
80             build-days-to-keep: '{build-days-to-keep}'
81
82     parameters:
83         - opendaylight-infra-parameters:
84             project: 'integration/distribution'
85             branch: '{branch}'
86             refspec: 'refs/heads/{branch}'
87             artifacts: '{archive-artifacts} **/dependency_tree.txt **/target/surefire-reports/*-output.txt'
88
89     scm:
90         - git-scm:
91             refspec: ''
92             branch: '{branch}'
93
94     wrappers:
95         - opendaylight-infra-wrappers:
96             build-timeout: '{build-timeout}'
97
98     triggers:
99         - reverse:
100             jobs: '{project}-merge-{stream}'
101             result: 'success'
102
103     prebuilders:
104         - provide-maven-settings:
105             global-settings-file: 'odl-global-settings'
106             settings-file: '{mvn-settings}'
107         - distribute-build-url:
108             path: 'distribution-karaf/src/main/assembly'
109
110     maven:
111         maven-name: 'mvn33'
112         root-pom: 'pom.xml'
113         goals: 'clean install dependency:tree -DoutputFile=dependency_tree.txt -V -B -Djenkins -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r'
114         maven-opts: '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'
115         settings: 'integration-distribution-settings'
116         settings-type: cfp
117         global-settings: 'odl-global-settings'
118         global-settings-type: cfp
119
120     publishers:
121         - email-notification:
122             email-recipients: '{email-recipients}'
123             email-prefix: '[{project}]'
124         - maven-deploy:
125             id: ''
126             unique-version: true
127             deploy-unstable: false
128         - opendaylight-infra-shiplogs:
129             maven-version: 'mvn33'
130
131 - job-template:
132     # Template: {name}-distribution-check-{stream}
133     # Goal: Build a patch and make sure the distribution can deploy with this change
134     # Operation: This job template builds a patch, creates a distribution containing
135     #            the patch, and triggers the distribution deploy test
136
137     name: '{project-name}-distribution-check-{stream}'
138     disabled: false
139
140     project-type: freestyle
141     node: '{build-node}'
142     concurrent: true
143     jdk: '{jdk}'
144
145     properties:
146         - opendaylight-infra-properties:
147             build-days-to-keep: '{build-days-to-keep}'
148
149     parameters:
150         - opendaylight-infra-parameters:
151             project: '{project}'
152             branch: '{branch}'
153             refspec: 'refs/heads/{branch}'
154             artifacts: '{archive-artifacts} **/dependency_tree.txt **/target/surefire-reports/*-output.txt'
155         - integration-distribution-git-url:
156             git-url: '{git-url}'
157
158     scm:
159         - integration-gerrit-scm:
160             basedir: '$GERRIT_PROJECT'
161             refspec: '$GERRIT_REFSPEC'
162             branch: '{branch}'
163         - integration-distribution-scm:
164             branch: '{branch}'
165
166     wrappers:
167         - opendaylight-infra-wrappers:
168             # Distro-check jobs typically run within 10 - 30 minutes
169             # with 45 minutes being the occassional edge case.
170             # enforce a 60 minute limit to ensure stuck jobs get
171             # cleared up sooner.
172             build-timeout: '60'
173
174     triggers:
175         - gerrit-trigger-patch-submitted:
176             server: '{server-name}'
177             project: '{project}'
178             branch: '{branch}'
179             files: '**'
180
181     builders:
182         - maven-target:
183             maven-version: 'mvn33'
184             pom: '$GERRIT_PROJECT/pom.xml'
185             goals: 'clean install dependency:tree -DoutputFile=dependency_tree.txt -V -B -Pq -Djenkins -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r -Dstream={stream}'
186             java-opts:
187                 - '-Xmx4096m -XX:MaxPermSize=1024m -Dmaven.compile.fork=true'
188             settings: '{mvn-settings}'
189             settings-type: cfp
190             global-settings: 'odl-global-settings'
191             global-settings-type: cfp
192         - maven-target:
193             maven-version: 'mvn33'
194             pom: 'distribution/pom.xml'
195             goals: 'clean install dependency:tree -DoutputFile=dependency_tree.txt -V -B -Djenkins -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r'
196             java-opts:
197               - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'
198             settings: '{mvn-settings}'
199             settings-type: cfp
200             global-settings: 'odl-global-settings'
201             global-settings-type: cfp
202         - integration-distribution-check
203
204     publishers:
205         - email-notification:
206             email-recipients: '{email-recipients}'
207             email-prefix: '[{project-name}]'
208         - postbuildscript:
209             builders:
210                 - shell: |
211                     #!/bin/bash
212                     mkdir -p $WORKSPACE/archives
213                     cp karaf*.log $WORKSPACE/archives
214             script-only-if-succeeded: False
215             script-only-if-failed: False
216             mark-unstable-if-failed: True
217         - archive:
218             artifacts: '*.zip'
219         - opendaylight-infra-shiplogs:
220             maven-version: 'mvn33'
221
222 - job-template:
223     name: '{project-name}-integration-{stream}'
224
225     # Job template for ODL integration verify jobs
226     #
227     # This is similar to a normal verify job, but it runs
228     # when a project that's a dependency of your project
229     # is successfully built.
230     #
231     # Required Variables:
232     #     stream:    release stream (eg. boron or carbon)
233     #     branch:    git branch (eg. stable/boron or master)
234
235     project-type: freestyle
236     node: '{build-node}'
237     jdk: '{jdk}'
238
239     properties:
240         - opendaylight-infra-properties:
241             build-days-to-keep: '{build-days-to-keep}'
242
243     parameters:
244         - opendaylight-infra-parameters:
245             project: '{project}'
246             branch: '{branch}'
247             refspec: 'refs/heads/{branch}'
248             artifacts: '{archive-artifacts}'
249
250     scm:
251         - git-scm:
252             refspec: ''
253             branch: '{branch}'
254
255     wrappers:
256         - opendaylight-infra-wrappers:
257             build-timeout: '{build-timeout}'
258
259     triggers:
260         - reverse:
261             jobs: '{dependencies}'
262             result: 'success'
263
264     builders:
265         - jacoco-nojava-workaround
266         - provide-maven-settings:
267             global-settings-file: 'odl-global-settings'
268             settings-file: '{mvn-settings}'
269         - maven-target:
270             maven-version: 'mvn33'
271             goals: '{mvn-goals} -V -B -Djenkins -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r'
272             java-opts:
273               - '{mvn-opts}'
274             settings: '{mvn-settings}'
275             settings-type: cfp
276             global-settings: 'odl-global-settings'
277             global-settings-type: cfp
278
279     publishers:
280         - email-notification:
281             email-recipients: '{email-recipients}'
282             email-prefix: '{email-upstream}'
283         - findbugs
284         - jacoco-report
285         - opendaylight-infra-shiplogs:
286             maven-version: 'mvn33'
287
288 - job-template:
289     name: '{project-name}-merge-{stream}'
290
291     # Job template for ODL merge jobs
292     #
293     # The purpose of this job template is to setup a ODL merge job
294     # and deploy artifacts to Nexus.
295     #
296     # Required Variables:
297     #     stream:    release stream (eg. boron or carbon)
298     #     branch:    git branch (eg. stable/boron or master)
299
300     # Need to keep jobs that deploy to Nexus at end of build as Maven
301     # projects. Maybe reconsider this once upstream moves deploy to a
302     # separate lifecycle:
303     #     https://issues.apache.org/jira/browse/MNG-5666
304     project-type: maven
305     node: '{build-node}'
306     jdk: '{jdk}'
307
308     properties:
309         - opendaylight-infra-properties:
310             build-days-to-keep: 14
311
312     parameters:
313         - opendaylight-infra-parameters:
314             project: '{project}'
315             branch: '{branch}'
316             refspec: 'refs/heads/{branch}'
317             artifacts: '{archive-artifacts}'
318
319     scm:
320         - gerrit-trigger-scm:
321             refspec: ''
322             choosing-strategy: 'default'
323
324     wrappers:
325         - opendaylight-infra-wrappers:
326             build-timeout: '{build-timeout}'
327
328     triggers:
329         - timed: 'H H * * 0'
330         - gerrit-trigger-patch-merged:
331             server-name: '{server-name}'
332             name: '{project}'
333             branch: '{branch}'
334
335     prebuilders:
336         - jacoco-nojava-workaround
337         - provide-maven-settings:
338             global-settings-file: 'odl-global-settings'
339             settings-file: '{mvn-settings}'
340
341     maven:
342         maven-name: 'mvn33'
343         goals: '{mvn-goals} -V -B -Djenkins -Dmerge -Dstream={stream} -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r'
344         maven-opts: '{mvn-opts}'
345         settings: '{mvn-settings}'
346         settings-type: cfp
347         global-settings: 'odl-global-settings'
348         global-settings-type: cfp
349         post-step-run-condition: UNSTABLE
350
351     postbuilders:
352         - conditional-step:
353             condition-kind: file-exists
354             condition-filename: deploy-site.xml
355             condition-basedir: workspace
356
357             # The strategy here is intentional to run Maven site:deploy twice
358             # once using regular pom.xml to produce a staged-site which is
359             # then used by deploy-site.xml to push to Nexus. This is a
360             # workaround to Maven Site's default linking code which creates
361             # incorrect URLs for sites due to auto-detection assuming your
362             # project is configured in a certain way which ODL is not.
363             steps:
364             - maven-target:
365                 maven-version: 'mvn33'
366                 pom: pom.xml
367                 goals: 'site:deploy -V -B -Dstream={stream}'
368                 java-opts:
369                     - '-Xmx2g'
370                 settings: '{mvn-settings}'
371                 settings-type: cfp
372                 global-settings: 'odl-global-settings'
373                 global-settings-type: cfp
374             - maven-target:
375                 maven-version: 'mvn33'
376                 pom: deploy-site.xml
377                 goals: 'site:deploy -V -B -Dstream={stream}'
378                 java-opts:
379                     - '-Xmx2g'
380                 settings: '{mvn-settings}'
381                 settings-type: cfp
382                 global-settings: 'odl-global-settings'
383                 global-settings-type: cfp
384
385     reporters:
386         - findbugs
387
388     publishers:
389         - email-notification:
390             email-recipients: '{email-recipients}'
391             email-prefix: '[{project-name}]'
392         - maven-deploy:
393             id: ''
394             unique-version: true
395             deploy-unstable: false
396         - jacoco-report
397         - opendaylight-infra-shiplogs:
398             maven-version: 'mvn33'
399
400 - job-template:
401     name: '{project-name}-sonar'
402     disabled: false
403
404     project-type: freestyle
405     node: '{build-node}'
406     jdk: 'openjdk8'
407
408     properties:
409         - opendaylight-infra-properties:
410             build-days-to-keep: 7
411
412     parameters:
413         - opendaylight-infra-parameters:
414             project: '{project}'
415             branch: '{branch}'
416             refspec: 'refs/heads/{branch}'
417             artifacts: '{archive-artifacts}'
418
419     scm:
420         - git-scm:
421             refspec: ''
422             branch: 'master'
423
424     wrappers:
425         - opendaylight-infra-wrappers:
426             build-timeout: '{build-timeout}'
427
428     triggers:
429         - timed: 'H H * * 6'
430         - gerrit-trigger-patch-sonar:
431             server-name: '{server-name}'
432             name: '{project}'
433             # FIXME: Make sure this does not alter Gerrit votes, then update docs.
434
435     builders:
436         - jacoco-nojava-workaround
437         - provide-maven-settings:
438             global-settings-file: 'odl-global-settings'
439             settings-file: '{mvn-settings}'
440         - maven-target:
441             maven-version: 'mvn33'
442             goals: '{mvn-goals} -V -B -Djenkins -Dsonar -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r'
443             maven-opts:
444               - '{mvn-opts}'
445             settings: '{mvn-settings}'
446             settings-type: cfp
447             global-settings: 'odl-global-settings'
448             global-settings-type: cfp
449         - maven-target:
450             maven-version: 'mvn33'
451             # We should switch to the recommended configuration of sonar once
452             # JJB adds support for configurating the Sonar wrapper:
453             #    http://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Jenkins
454             goals: 'sonar:sonar -V -B -Djenkins -Dsonar -Dsonar.host.url=https://sonar.opendaylight.org -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r'
455             maven-opts:
456               - '{mvn-opts}'
457             settings: '{mvn-settings}'
458             settings-type: cfp
459             global-settings: 'odl-global-settings'
460             global-settings-type: cfp
461
462     publishers:
463         - email-notification:
464             email-recipients: '{email-recipients}'
465             email-prefix: '[{project-name}]'
466         - jacoco-report
467         - findbugs
468         - opendaylight-infra-shiplogs:
469             maven-version: 'mvn33'
470
471 - job-template:
472     name: '{project-name}-validate-autorelease-{stream}'
473     disabled: false
474
475     project-type: freestyle
476     node: '{build-node}'
477     concurrent: true
478     jdk: '{jdk}'
479
480     properties:
481         - opendaylight-infra-properties:
482             build-days-to-keep: 7
483
484     parameters:
485         - opendaylight-infra-parameters:
486             project: '{project}'
487             branch: '{branch}'
488             refspec: 'refs/heads/{branch}'
489             artifacts: '{archive-artifacts}'
490         - autorelease-release-tag:
491             release-tag: 'validate'
492         - autorelease-release-branch:
493             release-branch: '{branch}'
494         - string:
495             name: CLONE_URL
496             default: '{git-url}/releng/autorelease'
497             description: "Autorelease clone URL"
498
499     scm:
500         - git:
501             url: '$CLONE_URL'
502             credentials-id: 'opendaylight-jenkins-ssh'
503             refspec: ''
504             branches:
505                 - 'origin/{branch}'
506             skip-tag: true
507             submodule:
508                 recursive: true
509                 timeout: 60
510
511     wrappers:
512         - opendaylight-infra-wrappers:
513             build-timeout: '{build-timeout}'
514
515     triggers:
516         - gerrit-trigger-patch-submitted:
517             server: '{server-name}'
518             project: '{project}'
519             branch: '{branch}'
520             files: '**/*.xml'
521
522     builders:
523         - jacoco-nojava-workaround
524         - autorelease-checkout-gerrit-patch
525         - autorelease-generate-release-patches
526         # In a perfect world projects should be releasing separately and we consume them
527         # via a project that pulls the release bits from each project from Nexus.
528         # Keep the patches compatible with that ideal, but apply an edit
529         # to enable building in a single maven reactor afterwards.
530         - autorelease-fix-relative-paths
531         - maven-target:
532             maven-version: 'mvn33'
533             pom: validate-pom.xml
534             goals: 'clean install dependency:tree -V -B -T1.5C -Pq -Djenkins -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r'
535             java-opts:
536               - '-Xmx8g'
537             settings: 'autorelease-settings'
538             settings-type: cfp
539             global-settings: 'odl-global-settings'
540             global-settings-type: cfp
541         - maven-target:
542             maven-version: 'mvn33'
543             pom: 'pom.xml'
544             goals: 'clean validate -V -B -Pq -Djenkins -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r'
545             java-opts:
546               - '-Xmx8g -XX:MaxPermSize=1024m -Dmaven.compile.fork=true'
547             settings: 'autorelease-settings'
548             settings-type: cfp
549             global-settings: 'odl-global-settings'
550             global-settings-type: cfp
551         - autorelease-sys-stats
552
553     publishers:
554         - email-notification:
555             email-recipients: '{email-recipients}'
556             email-prefix: '[autorelease] [{project-name}]'
557         - opendaylight-infra-shiplogs:
558             maven-version: 'mvn33'
559
560 - job-template:
561     name: '{project-name}-verify-{stream}-{maven}-{jdks}'
562
563     # Job template for ODL verify jobs
564     #
565     # The purpose of this job template is to setup a ODL verify job
566     #
567     # Required Variables:
568     #     stream:    release stream (eg. boron or carbon)
569     #     branch:    git branch (eg. stable/boron or master)
570
571     project-type: freestyle
572     node: '{build-node}'
573     concurrent: true
574     jdk: '{jdks}'
575
576     properties:
577         - opendaylight-infra-properties:
578             build-days-to-keep: 7
579
580     parameters:
581         - opendaylight-infra-parameters:
582             project: '{project}'
583             branch: '{branch}'
584             refspec: 'refs/heads/{branch}'
585             artifacts: '{archive-artifacts}'
586
587     scm:
588         - gerrit-trigger-scm:
589             refspec: '$GERRIT_REFSPEC'
590             choosing-strategy: 'gerrit'
591
592     wrappers:
593         - opendaylight-infra-wrappers:
594             build-timeout: '{build-timeout}'
595
596     triggers:
597         - gerrit-trigger-patch-submitted:
598             server: '{server-name}'
599             project: '{project}'
600             branch: '{branch}'
601             files: '**'
602
603     builders:
604         - jacoco-nojava-workaround
605         - provide-maven-settings:
606             global-settings-file: 'odl-global-settings'
607             settings-file: '{mvn-settings}'
608         - maven-target:
609             maven-version: '{mvn-version}'
610             goals: '{mvn-goals} -V -B -Djenkins -Dstream={stream} -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r'
611             java-opts:
612                 - '{mvn-opts}'
613             settings: '{mvn-settings}'
614             settings-type: cfp
615             global-settings: 'odl-global-settings'
616             global-settings-type: cfp
617
618     publishers:
619         - findbugs
620         - email-notification:
621             email-recipients: '{email-recipients}'
622             email-prefix: '[{project-name}]'
623         - jacoco-report
624         - opendaylight-infra-shiplogs:
625             maven-version: '{mvn-version}'