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