Migrate maven to freestyle for 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     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: maven
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     prebuilders:
350         - jacoco-nojava-workaround
351         - provide-maven-settings:
352             global-settings-file: 'odl-global-settings'
353             settings-file: '{mvn-settings}'
354
355     maven:
356         maven-name: '{mvn33}'
357         goals: '{mvn-goals} -V -B -Djenkins -Dmerge -Dstream={stream} -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r'
358         maven-opts: '{mvn-opts}'
359         settings: '{mvn-settings}'
360         settings-type: cfp
361         global-settings: 'odl-global-settings'
362         global-settings-type: cfp
363         post-step-run-condition: UNSTABLE
364
365     postbuilders:
366         - conditional-step:
367             condition-kind: file-exists
368             condition-filename: deploy-site.xml
369             condition-basedir: workspace
370
371             # The strategy here is intentional to run Maven site:deploy twice
372             # once using regular pom.xml to produce a staged-site which is
373             # then used by deploy-site.xml to push to Nexus. This is a
374             # workaround to Maven Site's default linking code which creates
375             # incorrect URLs for sites due to auto-detection assuming your
376             # project is configured in a certain way which ODL is not.
377             steps:
378             - maven-target:
379                 maven-version: '{mvn33}'
380                 pom: pom.xml
381                 goals: 'site:deploy -V -B -Dstream={stream}'
382                 java-opts:
383                     - '-Xmx2g'
384                 settings: '{mvn-settings}'
385                 settings-type: cfp
386                 global-settings: 'odl-global-settings'
387                 global-settings-type: cfp
388             - maven-target:
389                 maven-version: '{mvn33}'
390                 pom: deploy-site.xml
391                 goals: 'site:deploy -V -B -Dstream={stream}'
392                 java-opts:
393                     - '-Xmx2g'
394                 settings: '{mvn-settings}'
395                 settings-type: cfp
396                 global-settings: 'odl-global-settings'
397                 global-settings-type: cfp
398
399     reporters:
400         - findbugs
401
402     publishers:
403         - email-notification:
404             email-prefix: '[{project-name}]'
405         - maven-deploy:
406             id: ''
407             unique-version: true
408             deploy-unstable: false
409         - jacoco-report
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: maven
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     prebuilders:
510         - jacoco-nojava-workaround
511         - provide-maven-settings:
512             global-settings-file: 'odl-global-settings'
513             settings-file: '{mvn-settings}'
514
515     maven:
516         maven-name: '{mvn33}'
517         goals: '{mvn-goals} -V -B -Djenkins -Dsonar -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r'
518         maven-opts: '{mvn-opts}'
519         settings: '{mvn-settings}'
520         settings-type: cfp
521         global-settings: 'odl-global-settings'
522         global-settings-type: cfp
523
524     reporters:
525         - findbugs
526
527     publishers:
528         - sonar:
529             language: 'java'
530             maven-opts: '-Xmx6144m -XX:MaxPermSize=1024m'
531         - email-notification:
532             email-prefix: '[{project-name}]'
533         - jacoco-report
534         - opendaylight-infra-shiplogs:
535             maven-version: '{mvn33}'
536
537 - job-template:
538     name: '{project-name}-validate-autorelease-{stream}'
539     disabled: '{obj:disable_autorelease}'
540
541     project-type: freestyle
542     node: '{build-node}'
543     concurrent: true
544     jdk: '{jdk}'
545
546     logrotate:
547         daysToKeep: '7'
548
549     parameters:
550         - opendaylight-infra-parameters:
551             project: '{project}'
552             branch: '{branch}'
553             refspec: 'refs/heads/{branch}'
554             artifacts: '{archive-artifacts}'
555         - autorelease-release-tag:
556             release-tag: 'validate'
557         - autorelease-release-branch:
558             release-branch: '{branch}'
559         - string:
560             name: CLONE_URL
561             default: 'ssh://jenkins-$SILO@git.opendaylight.org:29418/releng/autorelease'
562             description: "Autorelease clone URL"
563
564     scm:
565         - git:
566             url: '$CLONE_URL'
567             credentials-id: 'opendaylight-jenkins-ssh'
568             refspec: ''
569             branches:
570                 - 'origin/{branch}'
571             skip-tag: true
572             submodule:
573                 recursive: true
574                 timeout: 60
575
576     wrappers:
577         - opendaylight-infra-wrappers:
578             build-timeout: '{build-timeout}'
579
580     triggers:
581         - gerrit:
582             server-name: 'OpenDaylight'
583             trigger-on:
584                 - patchset-created-event:
585                     exclude-drafts: 'true'
586                     exclude-trivial-rebase: 'false'
587                     exclude-no-code-change: 'true'
588                 - draft-published-event
589                 - comment-added-contains-event:
590                     comment-contains-value: 'recheck'
591                 - comment-added-contains-event:
592                     comment-contains-value: 'reverify'
593                 - comment-added-contains-event:
594                     comment-contains-value: 'revalidate'
595             projects:
596               - project-compare-type: 'ANT'
597                 project-pattern: '{project}'
598                 branches:
599                   - branch-compare-type: 'ANT'
600                     branch-pattern: '**/{branch}'
601                 file-paths:
602                     - compare-type: ANT
603                       pattern: '**/*.xml'
604
605     builders:
606         - jacoco-nojava-workaround
607         - autorelease-checkout-gerrit-patch
608         - autorelease-generate-release-patches
609         - maven-target:
610             maven-version: '{mvn33}'
611             pom: validate-pom.xml
612             goals: 'clean install dependency:tree -V -B -T1.5C -Pq -Djenkins -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r'
613             java-opts:
614               - '-Xmx8g'
615             settings: 'autorelease-settings'
616             settings-type: cfp
617             global-settings: 'odl-global-settings'
618             global-settings-type: cfp
619         - maven-target:
620             maven-version: '{mvn33}'
621             pom: 'pom.xml'
622             goals: 'clean validate -V -B -Pq -Djenkins -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r'
623             java-opts:
624               - '-Xmx8g -XX:MaxPermSize=1024m -Dmaven.compile.fork=true'
625             settings: 'autorelease-settings'
626             settings-type: cfp
627             global-settings: 'odl-global-settings'
628             global-settings-type: cfp
629         - autorelease-sys-stats
630
631     publishers:
632         - email-notification:
633             email-prefix: '[autorelease] [{project-name}]'
634         - opendaylight-infra-shiplogs:
635             maven-version: '{mvn33}'
636
637 - job-template:
638     name: '{project-name}-verify-{stream}-{maven}-{jdks}'
639
640     # Job template for ODL verify jobs
641     #
642     # The purpose of this job template is to setup a ODL verify job
643     #
644     # Required Variables:
645     #     stream:    release stream (eg. stable-lithium or beryllium)
646     #     branch:    git branch (eg. stable/lithium or master)
647
648     project-type: freestyle
649     node: '{build-node}'
650     concurrent: true
651     jdk: '{jdks}'
652
653     logrotate:
654         daysToKeep: '7'
655
656     parameters:
657         - opendaylight-infra-parameters:
658             project: '{project}'
659             branch: '{branch}'
660             refspec: 'refs/heads/{branch}'
661             artifacts: '{archive-artifacts}'
662
663     scm:
664         - gerrit-trigger-scm:
665             refspec: '$GERRIT_REFSPEC'
666             choosing-strategy: 'gerrit'
667
668     wrappers:
669         - opendaylight-infra-wrappers:
670             build-timeout: '{build-timeout}'
671
672     triggers:
673         - gerrit-trigger-patch-submitted:
674             name: '{project}'
675             branch: '{branch}'
676
677     builders:
678         - jacoco-nojava-workaround
679         - provide-maven-settings:
680             global-settings-file: 'odl-global-settings'
681             settings-file: '{mvn-settings}'
682         - maven-target:
683             maven-version: '{mvn-version}'
684             goals: '{mvn-goals} -V -B -Djenkins -Dstream={stream} -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r'
685             java-opts:
686                 - '{mvn-opts}'
687             settings: '{mvn-settings}'
688             settings-type: cfp
689             global-settings: 'odl-global-settings'
690             global-settings-type: cfp
691
692     publishers:
693         - findbugs
694         - email-notification:
695             email-prefix: '[{project-name}]'
696         - jacoco-report
697         - opendaylight-infra-shiplogs:
698             maven-version: '{mvn-version}'