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