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