Merge "Migrate maven to freestyle for merge"
[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     logrotate:
16         daysToKeep: '{build-days-to-keep}'
17         numToKeep: '{build-num-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-prefix: '[{project-name}]'
59         - opendaylight-infra-shiplogs:
60             maven-version: '{mvn33}'
61
62 - job-template:
63     name: '{project-name}-distribution-{stream}'
64
65     # Required variables:
66     #     stream:    release stream (eg. stable-lithium or beryllium)
67     #     branch:    git branch (eg. stable/lithium or master)
68
69     project-type: freestyle
70     node: '{build-node}'
71     jdk: '{jdk}'
72
73     logrotate:
74         daysToKeep: '{build-days-to-keep}'
75         numToKeep: '{build-num-to-keep}'
76         artifactDaysToKeep: '{build-artifact-days-to-keep}'
77         artifactNumToKeep: '{build-artifact-num-to-keep}'
78
79     parameters:
80         - opendaylight-infra-parameters:
81             project: 'integration/distribution'
82             branch: '{branch}'
83             refspec: 'refs/heads/{branch}'
84             artifacts: '{archive-artifacts} **/dependency_tree.txt **/target/surefire-reports/*-output.txt'
85
86     scm:
87         - git-scm:
88             refspec: ''
89             branch: '{branch}'
90
91     wrappers:
92         - opendaylight-infra-wrappers:
93             build-timeout: '{build-timeout}'
94
95     triggers:
96         - reverse:
97             jobs: '{project}-merge-{stream}'
98             result: 'success'
99
100     builders:
101         - provide-maven-settings:
102             global-settings-file: 'odl-global-settings'
103             settings-file: '{mvn-settings}'
104         - maven-target:
105             maven-version: '{mvn33}'
106             pom: 'pom.xml'
107             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'
108             java-opts:
109               - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'
110             settings: 'integration-distribution-settings'
111             settings-type: cfp
112             global-settings: 'odl-global-settings'
113             global-settings-type: cfp
114         - maven-target:
115             maven-version: '{mvn33}'
116             pom: 'pom.xml'
117             goals: 'validate jar:jar deploy:deploy -V -B -Djenkins -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r'
118             java-opts:
119               - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'
120             settings: 'integration-distribution-settings'
121             settings-type: cfp
122             global-settings: 'odl-global-settings'
123             global-settings-type: cfp
124
125     publishers:
126         - email-notification:
127             email-prefix: '[{project}]'
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: '{obj:disable_distribution_check}'
139
140     project-type: freestyle
141     node: '{build-node}'
142     concurrent: true
143     jdk: '{jdk}'
144
145     logrotate:
146         daysToKeep: '{build-days-to-keep}'
147         numToKeep: '{build-num-to-keep}'
148         artifactDaysToKeep: '{build-artifact-days-to-keep}'
149         artifactNumToKeep: '{build-artifact-num-to-keep}'
150
151     parameters:
152         - opendaylight-infra-parameters:
153             project: '{project}'
154             branch: '{branch}'
155             refspec: 'refs/heads/{branch}'
156             artifacts: '{archive-artifacts} **/dependency_tree.txt **/target/surefire-reports/*-output.txt'
157         - integration-distribution-git-url
158
159     scm:
160         - integration-gerrit-scm:
161             basedir: '$GERRIT_PROJECT'
162             refspec: '$GERRIT_REFSPEC'
163             branch: '{branch}'
164         - integration-distribution-scm:
165             branch: '{branch}'
166
167     wrappers:
168         - opendaylight-infra-wrappers:
169             build-timeout: '{build-timeout}'
170
171     triggers:
172         - gerrit:
173             server-name: 'OpenDaylight'
174             trigger-on:
175                 - patchset-created-event:
176                     exclude-drafts: 'true'
177                     exclude-trivial-rebase: 'false'
178                     exclude-no-code-change: 'true'
179                 - draft-published-event
180                 - comment-added-contains-event:
181                     comment-contains-value: 'test-distribution'
182                 - comment-added-contains-event:
183                     comment-contains-value: 'reverify'
184                 - comment-added-contains-event:
185                     comment-contains-value: 'recheck'
186             projects:
187               - project-compare-type: 'ANT'
188                 project-pattern: '{project}'
189                 branches:
190                   - branch-compare-type: 'ANT'
191                     branch-pattern: '**/{branch}'
192             skip-vote:
193                 successful: false
194                 failed: false
195                 unstable: false
196                 notbuilt: false
197
198     builders:
199         - maven-target:
200             maven-version: '{mvn33}'
201             pom: '$GERRIT_PROJECT/pom.xml'
202             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}'
203             java-opts:
204                 - '-Xmx4096m -XX:MaxPermSize=1024m -Dmaven.compile.fork=true'
205             settings: '{mvn-settings}'
206             settings-type: cfp
207             global-settings: 'odl-global-settings'
208             global-settings-type: cfp
209         - maven-target:
210             maven-version: '{mvn33}'
211             pom: 'distribution/pom.xml'
212             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'
213             java-opts:
214               - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'
215             settings: '{mvn-settings}'
216             settings-type: cfp
217             global-settings: 'odl-global-settings'
218             global-settings-type: cfp
219         - integration-distribution-check
220
221     publishers:
222         - email-notification:
223             email-prefix: '[{project-name}]'
224         - postbuildscript:
225             builders:
226                 - shell: |
227                     #!/bin/bash
228                     mkdir -p $WORKSPACE/archives
229                     cp karaf*.log $WORKSPACE/archives
230             script-only-if-succeeded: False
231             script-only-if-failed: False
232             mark-unstable-if-failed: True
233         - archive:
234             artifacts: '*.zip'
235         - opendaylight-infra-shiplogs:
236             maven-version: '{mvn33}'
237
238 - job-template:
239     name: '{project-name}-integration-{stream}'
240
241     # Job template for ODL integration verify jobs
242     #
243     # This is similar to a normal verify job, but it runs
244     # when a project that's a dependency of your project
245     # is successfully built.
246     #
247     # Required Variables:
248     #     stream:    release stream (eg. stable-lithium or beryllium)
249     #     branch:    git branch (eg. stable/lithium or master)
250
251     project-type: freestyle
252     node: '{build-node}'
253     jdk: '{jdk}'
254
255     logrotate:
256         daysToKeep: '{build-days-to-keep}'
257         numToKeep: '{build-num-to-keep}'
258         artifactDaysToKeep: '{build-artifact-days-to-keep}'
259         artifactNumToKeep: '{build-artifact-num-to-keep}'
260
261     parameters:
262         - opendaylight-infra-parameters:
263             project: '{project}'
264             branch: '{branch}'
265             refspec: 'refs/heads/{branch}'
266             artifacts: '{archive-artifacts}'
267
268     scm:
269         - git-scm:
270             refspec: ''
271             branch: '{branch}'
272
273     wrappers:
274         - opendaylight-infra-wrappers:
275             build-timeout: '{build-timeout}'
276
277     triggers:
278         - reverse:
279             jobs: '{dependencies}'
280             result: 'success'
281
282     builders:
283         - jacoco-nojava-workaround
284         - provide-maven-settings:
285             global-settings-file: 'odl-global-settings'
286             settings-file: '{mvn-settings}'
287         - maven-target:
288             maven-version: '{mvn33}'
289             goals: '{mvn-goals} -V -B -Djenkins -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r'
290             java-opts:
291               - '{mvn-opts}'
292             settings: '{mvn-settings}'
293             settings-type: cfp
294             global-settings: 'odl-global-settings'
295             global-settings-type: cfp
296
297     publishers:
298         - email-notification:
299             email-prefix: '{email-upstream}'
300         - findbugs
301         - jacoco-report
302         - opendaylight-infra-shiplogs:
303             maven-version: '{mvn33}'
304
305 - job-template:
306     name: '{project-name}-merge-{stream}'
307
308     # Job template for ODL merge jobs
309     #
310     # The purpose of this job template is to setup a ODL merge job
311     # and deploy artifacts to Nexus.
312     #
313     # Required Variables:
314     #     stream:    release stream (eg. stable-lithium or beryllium)
315     #     branch:    git branch (eg. stable/lithium or master)
316
317     project-type: freestyle
318     node: '{build-node}'
319     jdk: '{jdk}'
320
321     logrotate:
322         daysToKeep: '14'
323         numToKeep: '10'
324         artifactDaysToKeep: '{build-artifact-days-to-keep}'
325         artifactNumToKeep: '{build-artifact-num-to-keep}'
326
327     parameters:
328         - opendaylight-infra-parameters:
329             project: '{project}'
330             branch: '{branch}'
331             refspec: 'refs/heads/{branch}'
332             artifacts: '{archive-artifacts}'
333
334     scm:
335         - gerrit-trigger-scm:
336             refspec: ''
337             choosing-strategy: 'default'
338
339     wrappers:
340         - opendaylight-infra-wrappers:
341             build-timeout: '{build-timeout}'
342
343     triggers:
344         - timed: 'H H * * 0'
345         - gerrit-trigger-patch-merged:
346             name: '{project}'
347             branch: '{branch}'
348
349     builders:
350         - jacoco-nojava-workaround
351         - provide-maven-settings:
352             global-settings-file: 'odl-global-settings'
353             settings-file: '{mvn-settings}'
354         - maven-target:
355             maven-version: '{mvn33}'
356             goals: '{mvn-goals} -V -B -Djenkins -Dmerge -Dstream={stream} -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r'
357             java-opts:
358               - '{mvn-opts}'
359             settings: '{mvn-settings}'
360             settings-type: cfp
361             global-settings: 'odl-global-settings'
362             global-settings-type: cfp
363         - maven-target:
364             maven-version: '{mvn33}'
365             goals: 'validate jar:jar deploy:deploy -V -B -Djenkins -Dmerge -Dstream={stream} -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r'
366             java-opts:
367               - '{mvn-opts}'
368             settings: '{mvn-settings}'
369             settings-type: cfp
370             global-settings: 'odl-global-settings'
371             global-settings-type: cfp
372         - conditional-step:
373             condition-kind: file-exists
374             condition-filename: deploy-site.xml
375             condition-basedir: workspace
376
377             # The strategy here is intentional to run Maven site:deploy twice
378             # once using regular pom.xml to produce a staged-site which is
379             # then used by deploy-site.xml to push to Nexus. This is a
380             # workaround to Maven Site's default linking code which creates
381             # incorrect URLs for sites due to auto-detection assuming your
382             # project is configured in a certain way which ODL is not.
383             steps:
384             - maven-target:
385                 maven-version: '{mvn33}'
386                 pom: pom.xml
387                 goals: 'site:deploy -V -B -Dstream={stream}'
388                 java-opts:
389                     - '-Xmx2g'
390                 settings: '{mvn-settings}'
391                 settings-type: cfp
392                 global-settings: 'odl-global-settings'
393                 global-settings-type: cfp
394             - maven-target:
395                 maven-version: '{mvn33}'
396                 pom: deploy-site.xml
397                 goals: 'site:deploy -V -B -Dstream={stream}'
398                 java-opts:
399                     - '-Xmx2g'
400                 settings: '{mvn-settings}'
401                 settings-type: cfp
402                 global-settings: 'odl-global-settings'
403                 global-settings-type: cfp
404
405     publishers:
406         - email-notification:
407             email-prefix: '[{project-name}]'
408         - jacoco-report
409         - findbugs
410         - opendaylight-infra-shiplogs:
411             maven-version: '{mvn33}'
412
413 - job-template:
414     name: '{project-name}-periodic-{stream}'
415
416     # Job template for periodic builders
417     #
418     # The purpose of this job template is to setup a periodic
419     # builder.
420     #
421     # Required Variables:
422     #     stream:    release stream (eg. stable-lithium or beryllium)
423     #     branch:    git branch (eg. stable/lithium or master)
424
425     project-type: freestyle
426     node: '{build-node}'
427     jdk: '{jdk}'
428
429     logrotate:
430         daysToKeep: '14'
431
432     parameters:
433         - opendaylight-infra-parameters:
434             project: '{project}'
435             branch: '{branch}'
436             refspec: 'refs/heads/{branch}'
437             artifacts: '{archive-artifacts}'
438
439     scm:
440         - git-scm:
441             refspec: ''
442             branch: '{branch}'
443
444     wrappers:
445         - opendaylight-infra-wrappers:
446             build-timeout: '{build-timeout}'
447
448     triggers:
449         - timed: '@daily'
450
451     builders:
452         - jacoco-nojava-workaround
453         - provide-maven-settings:
454             global-settings-file: 'odl-global-settings'
455             settings-file: '{mvn-settings}'
456         - maven-target:
457             maven-version: '{mvn33}'
458             goals: '{mvn-goals} -V -B -Djenkins -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r'
459             java-opts:
460               - '{mvn-opts}'
461             settings: '{mvn-settings}'
462             settings-type: cfp
463             global-settings: 'odl-global-settings'
464             global-settings-type: cfp
465
466     publishers:
467         - email-notification:
468             email-prefix: '[{project-name}]'
469         - jacoco-report
470         - findbugs
471         - opendaylight-infra-shiplogs:
472             maven-version: '{mvn33}'
473
474 - job-template:
475     name: '{project-name}-sonar'
476     disabled: false
477
478     project-type: freestyle
479     node: '{build-node}'
480     jdk: 'openjdk8'
481
482     logrotate:
483         daysToKeep: '7'
484         numToKeep: '10'
485         artifactDaysToKeep: '1'
486         artifactNumToKeep: '1'
487
488     parameters:
489         - opendaylight-infra-parameters:
490             project: '{project}'
491             branch: '{branch}'
492             refspec: 'refs/heads/{branch}'
493             artifacts: '{archive-artifacts}'
494
495     scm:
496         - git-scm:
497             refspec: ''
498             branch: 'master'
499
500     wrappers:
501         - opendaylight-infra-wrappers:
502             build-timeout: '{build-timeout}'
503
504     triggers:
505         - timed: 'H H * * 6'
506         - gerrit-trigger-patch-sonar:
507             name: '{project}'
508
509     builders:
510         - jacoco-nojava-workaround
511         - provide-maven-settings:
512             global-settings-file: 'odl-global-settings'
513             settings-file: '{mvn-settings}'
514         - maven-target:
515             maven-version: '{mvn33}'
516             goals: '{mvn-goals} -V -B -Djenkins -Dsonar -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r'
517             maven-opts:
518               - '{mvn-opts}'
519             settings: '{mvn-settings}'
520             settings-type: cfp
521             global-settings: 'odl-global-settings'
522             global-settings-type: cfp
523         - maven-target:
524             maven-version: '{mvn33}'
525             # We should switch to the recommended configuration of sonar once
526             # JJB adds support for configurating the Sonar wrapper:
527             #    http://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Jenkins
528             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'
529             maven-opts:
530               - '{mvn-opts}'
531             settings: '{mvn-settings}'
532             settings-type: cfp
533             global-settings: 'odl-global-settings'
534             global-settings-type: cfp
535
536     publishers:
537         - email-notification:
538             email-prefix: '[{project-name}]'
539         - jacoco-report
540         - findbugs
541         - opendaylight-infra-shiplogs:
542             maven-version: '{mvn33}'
543
544 - job-template:
545     name: '{project-name}-validate-autorelease-{stream}'
546     disabled: '{obj:disable_autorelease}'
547
548     project-type: freestyle
549     node: '{build-node}'
550     concurrent: true
551     jdk: '{jdk}'
552
553     logrotate:
554         daysToKeep: '7'
555
556     parameters:
557         - opendaylight-infra-parameters:
558             project: '{project}'
559             branch: '{branch}'
560             refspec: 'refs/heads/{branch}'
561             artifacts: '{archive-artifacts}'
562         - autorelease-release-tag:
563             release-tag: 'validate'
564         - autorelease-release-branch:
565             release-branch: '{branch}'
566         - string:
567             name: CLONE_URL
568             default: 'ssh://jenkins-$SILO@git.opendaylight.org:29418/releng/autorelease'
569             description: "Autorelease clone URL"
570
571     scm:
572         - git:
573             url: '$CLONE_URL'
574             credentials-id: 'opendaylight-jenkins-ssh'
575             refspec: ''
576             branches:
577                 - 'origin/{branch}'
578             skip-tag: true
579             submodule:
580                 recursive: true
581                 timeout: 60
582
583     wrappers:
584         - opendaylight-infra-wrappers:
585             build-timeout: '{build-timeout}'
586
587     triggers:
588         - gerrit:
589             server-name: 'OpenDaylight'
590             trigger-on:
591                 - patchset-created-event:
592                     exclude-drafts: 'true'
593                     exclude-trivial-rebase: 'false'
594                     exclude-no-code-change: 'true'
595                 - draft-published-event
596                 - comment-added-contains-event:
597                     comment-contains-value: 'recheck'
598                 - comment-added-contains-event:
599                     comment-contains-value: 'reverify'
600                 - comment-added-contains-event:
601                     comment-contains-value: 'revalidate'
602             projects:
603               - project-compare-type: 'ANT'
604                 project-pattern: '{project}'
605                 branches:
606                   - branch-compare-type: 'ANT'
607                     branch-pattern: '**/{branch}'
608                 file-paths:
609                     - compare-type: ANT
610                       pattern: '**/*.xml'
611
612     builders:
613         - jacoco-nojava-workaround
614         - autorelease-checkout-gerrit-patch
615         - autorelease-generate-release-patches
616         - maven-target:
617             maven-version: '{mvn33}'
618             pom: validate-pom.xml
619             goals: 'clean install dependency:tree -V -B -T1.5C -Pq -Djenkins -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r'
620             java-opts:
621               - '-Xmx8g'
622             settings: 'autorelease-settings'
623             settings-type: cfp
624             global-settings: 'odl-global-settings'
625             global-settings-type: cfp
626         - maven-target:
627             maven-version: '{mvn33}'
628             pom: 'pom.xml'
629             goals: 'clean validate -V -B -Pq -Djenkins -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r'
630             java-opts:
631               - '-Xmx8g -XX:MaxPermSize=1024m -Dmaven.compile.fork=true'
632             settings: 'autorelease-settings'
633             settings-type: cfp
634             global-settings: 'odl-global-settings'
635             global-settings-type: cfp
636         - autorelease-sys-stats
637
638     publishers:
639         - email-notification:
640             email-prefix: '[autorelease] [{project-name}]'
641         - opendaylight-infra-shiplogs:
642             maven-version: '{mvn33}'
643
644 - job-template:
645     name: '{project-name}-verify-{stream}-{maven}-{jdks}'
646
647     # Job template for ODL verify jobs
648     #
649     # The purpose of this job template is to setup a ODL verify job
650     #
651     # Required Variables:
652     #     stream:    release stream (eg. stable-lithium or beryllium)
653     #     branch:    git branch (eg. stable/lithium or master)
654
655     project-type: freestyle
656     node: '{build-node}'
657     concurrent: true
658     jdk: '{jdks}'
659
660     logrotate:
661         daysToKeep: '7'
662
663     parameters:
664         - opendaylight-infra-parameters:
665             project: '{project}'
666             branch: '{branch}'
667             refspec: 'refs/heads/{branch}'
668             artifacts: '{archive-artifacts}'
669
670     scm:
671         - gerrit-trigger-scm:
672             refspec: '$GERRIT_REFSPEC'
673             choosing-strategy: 'gerrit'
674
675     wrappers:
676         - opendaylight-infra-wrappers:
677             build-timeout: '{build-timeout}'
678
679     triggers:
680         - gerrit-trigger-patch-submitted:
681             name: '{project}'
682             branch: '{branch}'
683
684     builders:
685         - jacoco-nojava-workaround
686         - provide-maven-settings:
687             global-settings-file: 'odl-global-settings'
688             settings-file: '{mvn-settings}'
689         - maven-target:
690             maven-version: '{mvn-version}'
691             goals: '{mvn-goals} -V -B -Djenkins -Dstream={stream} -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r'
692             java-opts:
693                 - '{mvn-opts}'
694             settings: '{mvn-settings}'
695             settings-type: cfp
696             global-settings: 'odl-global-settings'
697             global-settings-type: cfp
698
699     publishers:
700         - findbugs
701         - email-notification:
702             email-prefix: '[{project-name}]'
703         - jacoco-report
704         - opendaylight-infra-shiplogs:
705             maven-version: '{mvn-version}'