Rename archive-build macro to opendaylight-infra-shiplogs
[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 - scm:
76     name: git-scm
77     scm:
78         - git:
79             credentials-id: 'opendaylight-jenkins-ssh'
80             url: '$GIT_BASE'
81             refspec: ''
82             branches:
83                 - 'origin/{branch}'
84             skip-tag: true
85             wipe-workspace: true
86
87 - scm:
88     name: git-scm-with-submodules
89     scm:
90         - git:
91             credentials-id: 'opendaylight-jenkins-ssh'
92             url: '$GIT_BASE'
93             refspec: ''
94             branches:
95                 - 'refs/heads/{branch}'
96             skip-tag: true
97             wipe-workspace: true
98             submodule:
99                 recursive: true
100
101 - scm:
102     name: gerrit-trigger-scm
103     scm:
104         - git:
105             credentials-id: 'opendaylight-jenkins-ssh'
106             url: '$GIT_BASE'
107             refspec: '{refspec}'
108             branches:
109                 - 'origin/$GERRIT_BRANCH'
110             skip-tag: true
111             choosing-strategy: '{choosing-strategy}'
112
113 - wrapper:
114     name: build-timeout
115     wrappers:
116         - timeout:
117             type: absolute
118             timeout: 360
119             fail: true
120
121 - trigger:
122     name: gerrit-trigger-patch-submitted
123     triggers:
124         - gerrit:
125             server-name: 'OpenDaylight'
126             trigger-on:
127                 - patchset-created-event:
128                     exclude-drafts: 'false'
129                     exclude-trivial-rebase: 'false'
130                     exclude-no-code-change: 'false'
131                 - draft-published-event
132                 - comment-added-contains-event:
133                     comment-contains-value: 'recheck'
134                 - comment-added-contains-event:
135                     comment-contains-value: 'reverify'
136             projects:
137               - project-compare-type: 'ANT'
138                 project-pattern: '{name}'
139                 branches:
140                   - branch-compare-type: 'ANT'
141                     branch-pattern: '**/{branch}'
142
143 - trigger:
144     name: gerrit-trigger-relevant-patch-submitted
145     triggers:
146         - gerrit:
147             server-name: 'OpenDaylight'
148             trigger-on:
149                 - patchset-created-event:
150                     exclude-drafts: 'true'
151                     exclude-trivial-rebase: 'false'
152                     exclude-no-code-change: 'true'
153                 - draft-published-event
154                 - comment-added-contains-event:
155                     comment-contains-value: 'recheck'
156                 - comment-added-contains-event:
157                     comment-contains-value: 'reverify'
158             projects:
159               - project-compare-type: 'ANT'
160                 project-pattern: '{name}'
161                 branches:
162                   - branch-compare-type: 'ANT'
163                     branch-pattern: '**/{branch}'
164
165 - trigger:
166     name: gerrit-trigger-patch-merged
167     triggers:
168         - gerrit:
169             server-name: 'OpenDaylight'
170             trigger-on:
171                 - change-merged-event
172                 - comment-added-contains-event:
173                     comment-contains-value: 'remerge'
174             projects:
175               - project-compare-type: 'ANT'
176                 project-pattern: '{name}'
177                 branches:
178                   - branch-compare-type: 'ANT'
179                     branch-pattern: '**/{branch}'
180
181 - trigger:
182     name: gerrit-trigger-patch-sonar
183     triggers:
184         - gerrit:
185             server-name: 'OpenDaylight'
186             trigger-on:
187                 - comment-added-contains-event:
188                     comment-contains-value: 'run-sonar'
189             projects:
190               - project-compare-type: 'ANT'
191                 project-pattern: '{name}'
192                 branches:
193                   - branch-compare-type: 'ANT'
194                     branch-pattern: '**/master'
195             skip-vote:
196                 successful: true
197                 failed: true
198                 unstable: true
199                 notbuilt: true
200
201 - trigger:
202     name: gerrit-trigger-patch-site-merged
203     triggers:
204         - gerrit:
205             server-name: 'OpenDaylight'
206             trigger-on:
207                 - change-merged-event
208                 - comment-added-contains-event:
209                     comment-contains-value: 'republish'
210             projects:
211               - project-compare-type: 'ANT'
212                 project-pattern: '{name}'
213                 branches:
214                     - branch-compare-type: 'ANT'
215                       branch-pattern: '**/{branch}'
216
217 - publisher:
218     name: archive-artifacts
219     publishers:
220         - archive:
221             artifacts: '{artifacts}'
222             allow-empty: true
223             fingerprint: true
224             latest-only: true
225
226 - publisher:
227     name: email-notification
228     publishers:
229         - email-ext:
230             recipients: 'jenkins@lists.opendaylight.org'
231             reply-to:
232             content-type: default
233             subject: '{email-prefix} $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!'
234             body: |
235                 $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
236
237                 Check console output at $BUILD_URL to view the results.
238             unstable: true
239             fixed: true
240             send-to:
241                 - recipients
242
243 - publisher:
244         name: jacoco-report
245         publishers:
246             - jacoco:
247                 exec-pattern: "**/**.exec"
248                 class-pattern: "**/classes"
249                 source-pattern: "**/src/main/java"
250                 exclusion-pattern: "**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**"
251                 status-update: true
252                 targets:
253                   - branch:
254                       healthy: 10
255                       unhealthy: 20
256                   - method:
257                       healthy: 50
258                       unhealthy: 40
259
260 - publisher:
261     name: opendaylight-infra-shiplogs
262     # To archive things the job will need to create a "archives" directory in
263     # the workspace and this macro will handle copying the contents of the
264     # archives directory.
265     #
266     # Uses the build parameter ARCHIVE_ARTIFACTS if not empty to find files
267     # to archive. You can pass globstar patterns for example "**/*.xml **/*.log"
268     # as the archive pattern. This is a space separated list of files to archive.
269     #
270     # Also ensure that the workspace is cleaned up at the end of the build.
271     publishers:
272         - postbuildscript:
273             builders:
274                 - shell: !include-raw: include-raw-deploy-archives.sh
275                 - maven-target:
276                         maven-version: '{maven-version}'
277                         pom: '.archives/deploy-archives.xml'
278                         goals: 'clean deploy -V -B -q -Dmaven.repo.local=/tmp/r'
279                         settings: 'jenkins-log-archives-settings'
280                         settings-type: cfp
281                         global-settings: 'odl-global-settings'
282                         global-settings-type: cfp
283                 - description-setter:
284                     regexp: '^Build logs: .*'
285                 # Cleanup after ourselves
286                 - wipe-org-opendaylight-repo
287             script-only-if-succeeded: False
288             script-only-if-failed: False
289             mark-unstable-if-failed: True
290         - workspace-cleanup:
291             fail-build: false
292
293 - builder:
294     name: opendaylight-infra-pre-builders
295     builders:
296         - shell: |
297             if [ ! -z "$GERRIT_PATCHSET_REVISION" ]; then
298                 LOG_MESSAGE="
299                     Logs for $JOB_NAME:
300                     https://logs.opendaylight.org/$SILO/$JENKINS_HOSTNAME/$JOB_NAME/$BUILD_NUMBER
301                     (note that logs will be unavailable until the job is completed running.)
302                 "
303                 ssh -p 29418 jenkins-$SILO@git.opendaylight.org gerrit review -m \"${LOG_MESSAGE}\" $GERRIT_PATCHSET_REVISION
304             fi
305
306 - builder:
307     name: wipe-org-opendaylight-repo
308     builders:
309         - shell: 'if [ -d /tmp/r/org/opendaylight ]; then rm -rf /tmp/r/org/opendaylight; fi'
310
311 - builder:
312     name: wipe-local-maven-repo
313     builders:
314         - shell: 'if [ -d /tmp/r ]; then rm -rf /tmp/r; fi'
315
316 - builder:
317     name: jacoco-nojava-workaround
318     builders:
319         - shell: 'mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes'
320
321 - builder:
322     name: check-clm
323     builders:
324         - sonatype-clm:
325             application-name: '{application-name}'
326
327 - builder:
328     name: releng-check-unicode
329     builders:
330         - shell: |
331             $WORKSPACE/scripts/check-unicode.sh jjb/
332
333 - builder:
334     name: provide-maven-settings
335     builders:
336     - config-file-provider:
337         files:
338         - file-id: '{global-settings-file}'
339           variable: 'GLOBAL_SETTINGS_FILE'
340         - file-id: '{settings-file}'
341           variable: 'SETTINGS_FILE'
342
343 - builder:
344     name: releng-fetch-p2zip-if-necessary
345     builders:
346     - shell: |
347         # Cleanup any existing zips and metadata before we download the new update site
348         rm -f *.zip *.xml
349     - conditional-step:
350         condition-kind: strings-match
351         condition-string1: '$P2ZIP_URL'
352         condition-string2: ''
353         condition-basedir: workspace
354         steps:
355             # TODO: Figure out latest snapshot version number to pull rather than hardcoding 1.1.1-SNAPSHOT
356             - maven-target:
357                 maven-version: '{maven-version}'
358                 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'
359                 settings: '{settings}'
360                 global-settings: '{global-settings}'
361
362 - builder:
363     name: releng-generate-p2pom
364     builders:
365         - shell: !include-raw: include-raw-generate-p2pom.sh
366
367 - builder:
368     name: releng-update-p2composite-metadata
369     builders:
370     - shell: !include-raw: include-raw-update-p2composite-metadata.sh
371     - conditional-step:
372         condition-kind: file-exists
373         condition-filename: deploy-composite-repo.xml
374         condition-basedir: workspace
375         steps:
376             - maven-target:
377                 maven-version: '{maven-version}'
378                 pom: 'deploy-composite-repo.xml'
379                 goals: 'clean deploy -V -B -Dmaven.repo.local=/tmp/r'
380                 settings: '{settings}'
381                 global-settings: '{global-settings}'
382
383 - builder:
384     name: releng-stage-release
385     builders:
386         - shell: !include-raw: include-raw-stage-release.sh
387
388 - wrapper:
389     # This wrapper is required for all jobs as it configures the wrappers
390     # needed by OpenDaylight infra.
391     name: opendaylight-infra-wrappers
392     wrappers:
393         - timeout:
394             type: absolute
395             timeout: '{build-timeout}'
396             timeout-var: 'BUILD_TIMEOUT'
397             fail: true
398         - ssh-agent-credentials:
399             users:
400                 - 'opendaylight-jenkins-ssh'
401         - jclouds:
402             single-use: True
403         - openstack:
404             single-use: True