refactor email recipients to parameter with default value
[releng/builder.git] / jjb / releng-macros.yaml
1 # OLD Releng macros
2
3 - parameter:
4     name: opendaylight-infra-parameters
5     parameters:
6         - string:
7             name: PROJECT
8             default: '{project}'
9             description: 'Parameter to identify an ODL Gerrit project'
10         - string:
11             name: ARCHIVE_ARTIFACTS
12             default: '{artifacts} **/target/surefire-reports/*-output.txt'
13             description: 'Space separated glob patterns for artifacts to archive into logs.opendaylight.org'
14         - string:
15             name: GERRIT_PROJECT
16             default: '{project}'
17             description: "GERRIT_PROJECT parameter if not given by trigger"
18         - string:
19             name: GERRIT_BRANCH
20             default: '{branch}'
21             description: "JJB configured GERRIT_BRANCH parameter"
22         - string:
23             name: GERRIT_REFSPEC
24             default: '{refspec}'
25             description: "GERRIT_REFSPEC parameter if not given by trigger"
26
27 - parameter:
28     name: build-tag
29     parameters:
30         - string:
31             name: BUILD_TAG
32             default: ''
33             description: 'Tag in Git to checkout'
34
35 - parameter:
36     name: controller-version-parameter
37     parameters:
38         - string:
39             name: ODL_VERSION
40             default: '{odl_version}'
41             description: 'Controller version (for use with openstacks networking_odl project)'
42
43 - parameter:
44     name: patches-to-build-parameter
45     parameters:
46         - string:
47             name: PATCHES_TO_BUILD
48             default: ''
49             description: 'csv list of patches in project:changeset format to build distribution with'
50
51 - parameter:
52     name: distribution-branch-to-build-parameter
53     parameters:
54         - string:
55             name: DISTRIBUTION_BRANCH_TO_BUILD
56             default: 'master'
57             description: 'distribution repo branch to build with'
58
59 - parameter:
60     name: p2zip-parameter
61     parameters:
62         - string:
63             name: P2ZIP_URL
64             default: ''
65             description: 'Nexus staging profile id'
66
67 - parameter:
68     name: stage-id-parameter
69     parameters:
70         - string:
71             name: STAGING_PROFILE_ID
72             default: '{stage-id}'
73             description: 'Nexus staging profile id'
74
75 - parameter:
76     name: maven-exec
77     parameters:
78       - string:
79           name: MVN
80           default: '/w/tools/hudson.tasks.Maven_MavenInstallation/{maven-version}/bin/mvn'
81           description: 'Maven selector to be used by shell scripts'
82
83 - scm:
84     name: git-scm
85     scm:
86         - git:
87             credentials-id: 'opendaylight-jenkins-ssh'
88             url: '$GIT_BASE'
89             refspec: ''
90             branches:
91                 - 'origin/{branch}'
92             skip-tag: true
93             wipe-workspace: true
94
95 - scm:
96     name: git-scm-with-submodules
97     scm:
98         - git:
99             credentials-id: 'opendaylight-jenkins-ssh'
100             url: '$GIT_BASE'
101             refspec: ''
102             branches:
103                 - 'refs/heads/{branch}'
104             skip-tag: true
105             wipe-workspace: true
106             submodule:
107                 recursive: true
108
109 - scm:
110     name: gerrit-trigger-scm
111     scm:
112         - git:
113             credentials-id: 'opendaylight-jenkins-ssh'
114             url: '$GIT_BASE'
115             refspec: '{refspec}'
116             branches:
117                 - 'origin/$GERRIT_BRANCH'
118             skip-tag: true
119             choosing-strategy: '{choosing-strategy}'
120
121 - wrapper:
122     name: build-timeout
123     wrappers:
124         - timeout:
125             type: absolute
126             timeout: 360
127             fail: true
128
129 # Used only by opflex-verify-{stream} and {project-name}-verify-{stream}-{maven}-{jdks}
130 - trigger:
131     name: gerrit-trigger-patch-submitted
132     triggers:
133         - gerrit:
134             server-name: 'OpenDaylight'
135             trigger-on:
136                 - patchset-created-event:
137                     exclude-drafts: 'true'
138                     exclude-trivial-rebase: 'false'
139                     exclude-no-code-change: 'true'
140                 - draft-published-event
141                 - comment-added-contains-event:
142                     comment-contains-value: 'recheck'
143                 - comment-added-contains-event:
144                     comment-contains-value: 'reverify'
145             projects:
146               - project-compare-type: 'ANT'
147                 project-pattern: '{name}'
148                 branches:
149                   - branch-compare-type: 'ANT'
150                     branch-pattern: '**/{branch}'
151
152 - trigger:
153     name: gerrit-trigger-patch-merged
154     triggers:
155         - gerrit:
156             server-name: 'OpenDaylight'
157             trigger-on:
158                 - change-merged-event
159                 - comment-added-contains-event:
160                     comment-contains-value: 'remerge'
161             projects:
162               - project-compare-type: 'ANT'
163                 project-pattern: '{name}'
164                 branches:
165                   - branch-compare-type: 'ANT'
166                     branch-pattern: '**/{branch}'
167             skip-vote:
168                 successful: true
169                 failed: true
170                 unstable: true
171                 notbuilt: true
172             # Force Jenkins always vote the values it should already have voted
173             # during the prior verify phase
174             override-votes: true
175             gerrit-build-started-verified-value: 1
176             gerrit-build-successful-verified-value: 1
177             gerrit-build-failed-verified-value: 1
178             gerrit-build-unstable-verified-value: 1
179             gerrit-build-notbuilt-verified-value: 1
180             gerrit-build-started-codereview-value: 0
181             gerrit-build-successful-codereview-value: 0
182             gerrit-build-failed-codereview-value: 0
183             gerrit-build-unstable-codereview-value: 0
184             gerrit-build-notbuilt-codereview-value: 0
185
186 - trigger:
187     name: gerrit-trigger-patch-sonar
188     triggers:
189         - gerrit:
190             server-name: 'OpenDaylight'
191             trigger-on:
192                 - comment-added-contains-event:
193                     comment-contains-value: 'run-sonar'
194             projects:
195               - project-compare-type: 'ANT'
196                 project-pattern: '{name}'
197                 branches:
198                   - branch-compare-type: 'ANT'
199                     branch-pattern: '**/master'
200             skip-vote:
201                 successful: true
202                 failed: true
203                 unstable: true
204                 notbuilt: true
205
206 - trigger:
207     name: gerrit-trigger-patch-site-merged
208     triggers:
209         - gerrit:
210             server-name: 'OpenDaylight'
211             trigger-on:
212                 - change-merged-event
213                 - comment-added-contains-event:
214                     comment-contains-value: 'republish'
215             projects:
216               - project-compare-type: 'ANT'
217                 project-pattern: '{name}'
218                 branches:
219                     - branch-compare-type: 'ANT'
220                       branch-pattern: '**/{branch}'
221             # Force Jenkins always vote the values it should already have voted
222             # during the prior verify phase
223             override-votes: true
224             gerrit-build-started-verified-value: 1
225             gerrit-build-successful-verified-value: 1
226             gerrit-build-failed-verified-value: 1
227             gerrit-build-unstable-verified-value: 1
228             gerrit-build-notbuilt-verified-value: 1
229             gerrit-build-started-codereview-value: 0
230             gerrit-build-successful-codereview-value: 0
231             gerrit-build-failed-codereview-value: 0
232             gerrit-build-unstable-codereview-value: 0
233             gerrit-build-notbuilt-codereview-value: 0
234
235 - publisher:
236     name: archive-artifacts
237     publishers:
238         - archive:
239             artifacts: '{artifacts}'
240             allow-empty: true
241             fingerprint: true
242             latest-only: true
243
244 - publisher:
245     name: email-notification
246     publishers:
247         - email-ext:
248             recipients: '{email-recipients}'
249             reply-to: ''
250             content-type: default
251             subject: '{email-prefix} $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!'
252             body: |
253                 $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
254
255                 Check console output at $BUILD_URL to view the results.
256             unstable: true
257             fixed: true
258             send-to:
259                 - recipients
260
261 - publisher:
262         name: jacoco-report
263         publishers:
264             - jacoco:
265                 exec-pattern: "**/**.exec"
266                 class-pattern: "**/classes"
267                 source-pattern: "**/src/main/java"
268                 exclusion-pattern: "**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**"
269                 status-update: true
270                 targets:
271                   - branch:
272                       healthy: 10
273                       unhealthy: 20
274                   - method:
275                       healthy: 50
276                       unhealthy: 40
277
278 - publisher:
279     name: opendaylight-infra-shiplogs
280     # To archive things the job will need to create a "archives" directory in
281     # the workspace and this macro will handle copying the contents of the
282     # archives directory.
283     #
284     # Uses the build parameter ARCHIVE_ARTIFACTS if not empty to find files
285     # to archive. You can pass globstar patterns for example "**/*.xml **/*.log"
286     # as the archive pattern. This is a space separated list of files to archive.
287     #
288     # Also ensure that the workspace is cleaned up at the end of the build.
289     publishers:
290         - postbuildscript:
291             builders:
292                 - shell: !include-raw: include-raw-deploy-archives.sh
293                 - maven-target:
294                         maven-version: '{maven-version}'
295                         pom: '.archives/deploy-archives.xml'
296                         goals: 'clean deploy -V -B -q -Dmaven.repo.local=/tmp/r'
297                         settings: 'jenkins-log-archives-settings'
298                         settings-type: cfp
299                         global-settings: 'odl-global-settings'
300                         global-settings-type: cfp
301                 - description-setter:
302                     regexp: '^Build logs: .*'
303                 # Cleanup after ourselves
304                 - wipe-org-opendaylight-repo
305             script-only-if-succeeded: False
306             script-only-if-failed: False
307             mark-unstable-if-failed: True
308         - workspace-cleanup:
309             exclude:
310               # Do not clean up *.jenkins-trigger files for jobs that use a
311               # properties file as input for triggering another build.
312               - '**/*.jenkins-trigger'
313             fail-build: false
314
315 - builder:
316     name: wipe-org-opendaylight-repo
317     builders:
318         - shell: 'if [ -d /tmp/r/org/opendaylight ]; then rm -rf /tmp/r/org/opendaylight; fi'
319
320 - builder:
321     name: wipe-local-maven-repo
322     builders:
323         - shell: 'if [ -d /tmp/r ]; then rm -rf /tmp/r; fi'
324
325 - builder:
326     name: jacoco-nojava-workaround
327     builders:
328         - shell: 'mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes'
329
330 - builder:
331     name: check-clm
332     builders:
333         - sonatype-clm:
334             application-name: '{application-name}'
335
336 - builder:
337     name: releng-check-unicode
338     builders:
339         - shell: |
340             $WORKSPACE/scripts/check-unicode.sh jjb/
341
342 - builder:
343     name: provide-maven-settings
344     builders:
345     - config-file-provider:
346         files:
347         - file-id: '{global-settings-file}'
348           variable: 'GLOBAL_SETTINGS_FILE'
349         - file-id: '{settings-file}'
350           variable: 'SETTINGS_FILE'
351
352 - builder:
353     name: releng-fetch-p2zip-if-necessary
354     builders:
355     - shell: |
356         # Cleanup any existing zips and metadata before we download the new update site
357         rm -f *.zip *.xml
358     - conditional-step:
359         condition-kind: strings-match
360         condition-string1: '$P2ZIP_URL'
361         condition-string2: ''
362         condition-basedir: workspace
363         steps:
364             # TODO: Figure out latest snapshot version number to pull rather than hardcoding 1.1.1-SNAPSHOT
365             - maven-target:
366                 maven-version: '{maven-version}'
367                 goals: 'org.apache.maven.plugins:maven-dependency-plugin:get org.apache.maven.plugins:maven-dependency-plugin:copy -V -B -Dartifact=org.opendaylight.yangide:org.opendaylight.yangide.update-site:1.1.1-SNAPSHOT:zip -DoutputDirectory=$WORKSPACE'
368                 settings: '{settings}'
369                 global-settings: '{global-settings}'
370
371 - builder:
372     name: releng-generate-p2pom
373     builders:
374         - shell: !include-raw: include-raw-generate-p2pom.sh
375
376 - builder:
377     name: releng-update-p2composite-metadata
378     builders:
379     - shell: !include-raw: include-raw-update-p2composite-metadata.sh
380     - conditional-step:
381         condition-kind: file-exists
382         condition-filename: deploy-composite-repo.xml
383         condition-basedir: workspace
384         steps:
385             - maven-target:
386                 maven-version: '{maven-version}'
387                 pom: 'deploy-composite-repo.xml'
388                 goals: 'clean deploy -V -B -Dmaven.repo.local=/tmp/r'
389                 settings: '{settings}'
390                 global-settings: '{global-settings}'
391
392 - builder:
393     name: releng-stage-release
394     builders:
395         - shell: !include-raw: include-raw-stage-release.sh
396
397 - wrapper:
398     # This wrapper is required for all jobs as it configures the wrappers
399     # needed by OpenDaylight infra.
400     name: opendaylight-infra-wrappers
401     wrappers:
402         - timeout:
403             type: absolute
404             timeout: '{build-timeout}'
405             timeout-var: 'BUILD_TIMEOUT'
406             fail: true
407         - timestamps
408         - ssh-agent-credentials:
409             users:
410                 - 'opendaylight-jenkins-ssh'
411         - jclouds:
412             single-use: True
413         - openstack:
414             single-use: True
415
416 - builder:
417     name: packer-validate
418     builders:
419         - config-file-provider:
420             files:
421                 - file-id: 'packer-cloud-env'
422                   variable: 'CLOUDENV'
423         - shell: |
424             cd packer
425             export PACKER_LOG="yes" && \
426             export PACKER_LOG_PATH="packer-validate.log" && \
427                         packer.io validate -var-file=$CLOUDENV \
428                          -var-file=../packer/vars/{platform}.json \
429                          ../packer/templates/{template}.json
430
431 - builder:
432     name: packer-build
433     builders:
434         - shell: |
435             cd packer
436             export PACKER_LOG="yes" && \
437             export PACKER_LOG_PATH="packer-build.log" && \
438                         packer.io build -var-file=$CLOUDENV \
439                          -var-file=../packer/vars/{platform}.json \
440                          ../packer/templates/{template}.json