Remove unused releng macros
[releng/builder.git] / jjb / releng-macros.yaml
1 # OLD Releng macros
2 ---
3 - property:
4     name: opendaylight-infra-properties
5     properties:
6       - build-discarder:
7           days-to-keep: '{build-days-to-keep}'
8           num-to-keep: 40
9           # Need to keep artifacts for at least 1 day as some projects need to
10           # be able to validate their artifacts and only allowing limited
11           # number of artifacts could make fast moving jobs lost their
12           # artifacts before the developers can test it.
13           artifact-days-to-keep: 1
14
15 - parameter:
16     name: opendaylight-infra-parameters
17     parameters:
18       - string:
19           name: PROJECT
20           default: '{project}'
21           description: 'Parameter to identify an ODL Gerrit project'
22       - string:
23           name: ARCHIVE_ARTIFACTS
24           # Before adding more here, beware of https://jira.linuxfoundation.org/browse/RELENG-280
25           default: >
26               {artifacts}
27               **/target/surefire-reports/*-output.txt
28               **/target/failsafe-reports/failsafe-summary.xml
29               **/hs_err_*.log
30               **/target/feature/feature.xml
31           # TODO: **/*.hprof is too large, compress with xz first
32           description: 'Space separated glob patterns for artifacts to archive into logs.opendaylight.org'
33       - string:
34           name: GERRIT_PROJECT
35           default: '{project}'
36           description: "GERRIT_PROJECT parameter if not given by trigger"
37       - string:
38           name: GERRIT_BRANCH
39           default: '{branch}'
40           description: "JJB configured GERRIT_BRANCH parameter"
41       - string:
42           name: GERRIT_REFSPEC
43           default: '{refspec}'
44           description: |
45               Gerrit reference to checkout (ex: refs/heads/master,
46               refs/changes/48/61548/1 where 61548 is Gerrit change ID, 1 is
47               patch number and 48 is last two digits of change ID)
48       - string:
49           name: STACK_NAME
50           default: '$SILO-$JOB_NAME-$BUILD_NUMBER'
51           description: "Used by Heat to generate a unique stack & vm name"
52       - string:
53           name: OS_CLOUD
54           default: '{os-cloud}'
55           description: |
56               The name of a cloud configuration in clouds.yaml. OS_CLOUD is a
57               variable name that is significant to openstack client as a
58               environment variable. Please refer to the documentation for
59               further details.
60               https://docs.openstack.org/developer/python-openstackclient/
61
62 - parameter:
63     name: patches-to-build-parameter
64     parameters:
65       - string:
66           name: PATCHES_TO_BUILD
67           default: ''
68           description: |
69               Ordered list of patches to build in the format of project=changeset (checkout) or
70               project:changeset (cherry-pick) for example: genius=32/53632/9,netvirt:59/50259/47.
71               A topic is also allowed, for example: topic=binding-tlc-rpc
72
73 - parameter:
74     name: build-order-parameter
75     parameters:
76       - string:
77           name: BUILD_ORDER
78           default: '{build-order}'
79           description: 'Build order for multipatch test when topic is used'
80
81 - parameter:
82     name: build-fast-parameter
83     parameters:
84       - string:
85           name: BUILD_FAST
86           default: '{build-fast}'
87           description: 'Set true to build fast -Pq'
88
89 - parameter:
90     name: run-test-parameter
91     parameters:
92       - string:
93           name: RUN_TEST
94           default: '{run-test}'
95           description: 'Set true to run test after build'
96
97 - parameter:
98     name: distribution-branch-to-build-parameter
99     parameters:
100       - string:
101           name: DISTRIBUTION_BRANCH_TO_BUILD
102           default: 'master'
103           description: 'distribution repo branch to build with'
104
105 - parameter:
106     name: p2zip-parameter
107     parameters:
108       - string:
109           name: P2ZIP_URL
110           default: ''
111           description: 'Nexus staging profile id'
112
113 - parameter:
114     name: stage-id-parameter
115     parameters:
116       - string:
117           name: STAGING_PROFILE_ID
118           default: '{stage-id}'
119           description: 'Nexus staging profile id'
120
121 - parameter:
122     name: maven-exec
123     parameters:
124       - string:
125           name: MVN
126           default: '/w/tools/hudson.tasks.Maven_MavenInstallation/{maven-version}/bin/mvn'
127           description: 'Maven selector to be used by shell scripts'
128
129 - scm:
130     name: git-scm
131     scm:
132       - git:
133           credentials-id: 'opendaylight-jenkins-ssh'
134           url: '$GIT_BASE'
135           refspec: ''
136           branches:
137             - 'origin/{branch}'
138           skip-tag: true
139           wipe-workspace: true
140
141 - scm:
142     name: git-scm-with-submodules
143     scm:
144       - git:
145           credentials-id: 'opendaylight-jenkins-ssh'
146           url: '$GIT_BASE'
147           refspec: ''
148           branches:
149             - 'refs/heads/{branch}'
150           skip-tag: true
151           wipe-workspace: true
152           submodule:
153             recursive: true
154
155 - scm:
156     name: gerrit-trigger-scm
157     scm:
158       - git:
159           credentials-id: 'opendaylight-jenkins-ssh'
160           url: '$GIT_BASE'
161           refspec: '{refspec}'
162           branches:
163             - 'origin/$GERRIT_BRANCH'
164           skip-tag: true
165           choosing-strategy: '{choosing-strategy}'
166
167 # This is a single macro to use for all jobs who vote on every (relevant) patch set.
168 # Only 'recheck' trigger word is supported, it always triggers the full set of relevant jobs,
169 # in order to prevent Jenkins from starting only a subset and still voting Verified+1.
170 # Arguments:
171 #     gerrit-server-name: name of gerrit server to listen to
172 #     project: pattern to match triggering projects
173 #     branch: triggering branch name
174 #     files: pattern to match triggering filepaths
175 - trigger:
176     name: gerrit-trigger-patch-submitted
177     triggers:
178       - gerrit:
179           server-name: '{gerrit-server-name}'
180           trigger-on:
181             - patchset-created-event:
182                 exclude-drafts: true
183                 exclude-trivial-rebase: false
184                 exclude-no-code-change: false
185             - draft-published-event
186             - comment-added-contains-event:
187                 comment-contains-value: '^Patch Set[ ]+[0-9]+:([ ]+|[\n]+)(recheck|reverify)$'
188           projects:
189             - project-compare-type: ANT
190               project-pattern: '{project}'
191               branches:
192                 - branch-compare-type: ANT
193                   branch-pattern: '**/{branch}'
194               file-paths:
195                 - compare-type: ANT
196                   pattern: '{files}'
197               forbidden-file-paths:
198                 - compare-type: ANT
199                   pattern: '{forbidden-files}'
200
201 # TODO: Unify argument names across gerrit-trigger-* macros.
202 - trigger:
203     name: gerrit-trigger-patch-merged
204     triggers:
205       - gerrit:
206           server-name: '{gerrit-server-name}'
207           trigger-on:
208             - change-merged-event
209             - comment-added-contains-event:
210                 comment-contains-value: 'remerge$'
211           projects:
212             - project-compare-type: 'ANT'
213               project-pattern: '{name}'
214               branches:
215                 - branch-compare-type: 'ANT'
216                   branch-pattern: '**/{branch}'
217               file-paths:
218                 - compare-type: ANT
219                   pattern: '{files}'
220               forbidden-file-paths:
221                 - compare-type: ANT
222                   pattern: '{forbidden-files}'
223           skip-vote:
224             successful: true
225             failed: true
226             unstable: true
227             notbuilt: true
228           # Force Jenkins always vote the values it should already have voted
229           # during the prior verify phase
230           override-votes: true
231           gerrit-build-started-verified-value: 1
232           gerrit-build-successful-verified-value: 1
233           gerrit-build-failed-verified-value: 1
234           gerrit-build-unstable-verified-value: 1
235           gerrit-build-notbuilt-verified-value: 1
236           gerrit-build-started-codereview-value: 0
237           gerrit-build-successful-codereview-value: 0
238           gerrit-build-failed-codereview-value: 0
239           gerrit-build-unstable-codereview-value: 0
240           gerrit-build-notbuilt-codereview-value: 0
241
242 - publisher:
243     name: email-notification
244     publishers:
245       - email-ext:
246           recipients: '{email-recipients}'
247           reply-to: ''
248           content-type: default
249           subject: '{email-prefix} $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!'
250           body: |
251               $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
252
253               Please refer to the logs server URL for console logs when possible
254               and use the Jenkins Build URL as a last resort.
255
256               Console Logs URL:
257               https://logs.opendaylight.org/$SILO/$JENKINS_HOSTNAME/$JOB_NAME/$BUILD_NUMBER
258
259               Jenkins Build URL:
260               $BUILD_URL
261           unstable: true
262           fixed: true
263           send-to:
264             - recipients
265
266
267 - builder:
268     # Installs the openstack cli into a virtualenv at /tmp/v/openstack
269     name: odl-openstack-install
270     builders:
271       - shell: !include-raw: odl-openstack-install.sh
272
273 - builder:
274     name: odl-openstack-check-image-protection
275     builders:
276       - shell: !include-raw: odl-openstack-check-image-protection.sh
277
278 - builder:
279     name: odl-openstack-cleanup-old-images
280     builders:
281       - shell: !include-raw: odl-openstack-cleanup-old-images.sh
282
283 - builder:
284     name: odl-openstack-cleanup-orphaned-nodes
285     builders:
286       - shell: !include-raw: odl-openstack-cleanup-orphaned-nodes.sh
287
288 - builder:
289     name: odl-openstack-cleanup-stale-nodes
290     builders:
291       - shell: !include-raw: odl-openstack-cleanup-stale-nodes.sh
292
293 - builder:
294     name: odl-openstack-cleanup-stale-stacks
295     builders:
296       - shell: !include-raw: odl-openstack-cleanup-stale-stacks.sh
297
298 - builder:
299     name: odl-openstack-cleanup-stale-volumes
300     builders:
301       - shell: !include-raw: odl-openstack-cleanup-stale-volumes.sh
302
303 - builder:
304     # Deploys a maven site to Nexus using lftools nexus-zip command
305     name: opendaylight-infra-deploy-maven-site
306     builders:
307       - lf-provide-maven-settings:
308           global-settings-file: global-settings
309           settings-file: '{settings-file}'
310       - lf-infra-create-netrc:
311           server-id: opendaylight-site
312       - shell: !include-raw-escape:
313           - global-jjb/shell/lftools-install.sh
314           - opendaylight-infra-deploy-maven-site.sh
315       - lf-provide-maven-settings-cleanup
316
317 - builder:
318     name: opendaylight-infra-stack
319     # opendaylight-infra-stack.sh has a required variable {stack-template} that
320     # must be passed into this macro.
321     builders:
322       - shell: !include-raw: opendaylight-infra-stack.sh
323       - shell: !include-raw-escape: opendaylight-infra-copy-ssh-keys.sh
324
325 - builder:
326     name: opendaylight-apex-stack
327     # opendaylight-apex-stack.sh has a required variable {stack-template} that
328     # must be passed into this macro.
329     builders:
330       - shell: !include-raw: opendaylight-infra-stack.sh
331
332 - builder:
333     name: distribute-build-url
334     # Place URL of the current run of a build job to a file at given path.
335     builders:
336       - shell: |
337           #!/bin/bash
338           set +e  # DO NOT fail script if command returns non-zero.
339
340           echo "$BUILD_URL" > {path}/build.url
341
342           # DO NOT fail the build if the echo failed.
343           exit 0
344
345 - builder:
346     name: wipe-org-opendaylight-repo
347     builders:
348       - shell: 'if [ -d /tmp/r/org/opendaylight ]; then rm -rf /tmp/r/org/opendaylight; fi'
349
350 - builder:
351     name: wipe-local-maven-repo
352     builders:
353       - shell: 'if [ -d /tmp/r ]; then rm -rf /tmp/r; fi'
354
355 - builder:
356     name: jacoco-nojava-workaround
357     builders:
358       - shell: 'mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes'
359
360 - builder:
361     name: provide-maven-settings
362     builders:
363       - config-file-provider:
364           files:
365             - file-id: '{global-settings-file}'
366               variable: 'GLOBAL_SETTINGS_FILE'
367             - file-id: '{settings-file}'
368               variable: 'SETTINGS_FILE'
369
370 - builder:
371     name: releng-fetch-p2zip-if-necessary
372     builders:
373       - shell: |
374           # Cleanup any existing zips and metadata before we download the new update site
375           rm -f *.zip *.xml
376       - conditional-step:
377           condition-kind: strings-match
378           condition-string1: '$P2ZIP_URL'
379           condition-string2: ''
380           condition-basedir: workspace
381           steps:
382             # TODO: Figure out latest snapshot version number to pull rather than hardcoding 1.1.1-SNAPSHOT
383             - maven-target:
384                 maven-version: '{maven-version}'
385                 goals: >
386                     org.apache.maven.plugins:maven-dependency-plugin:get
387                     org.apache.maven.plugins:maven-dependency-plugin:copy
388                     -V -B
389                     -Dartifact=org.opendaylight.yangide:org.opendaylight.yangide.update-site:1.1.1-SNAPSHOT:zip
390                     -DoutputDirectory=$WORKSPACE
391                 settings: '{settings}'
392                 global-settings: '{global-settings}'
393
394 - builder:
395     name: releng-generate-p2pom
396     builders:
397       - shell: !include-raw: generate-p2pom.sh
398
399 - builder:
400     name: releng-update-p2composite-metadata
401     builders:
402       - shell: !include-raw: update-p2composite-metadata.sh
403       - conditional-step:
404           condition-kind: file-exists
405           condition-filename: deploy-composite-repo.xml
406           condition-basedir: workspace
407           steps:
408             - maven-target:
409                 maven-version: '{maven-version}'
410                 pom: 'deploy-composite-repo.xml'
411                 goals: 'clean deploy -V -B -Dmaven.repo.local=/tmp/r'
412                 settings: '{settings}'
413                 global-settings: '{global-settings}'
414
415 - publisher:
416     name: releng-openstack-stack-delete
417     publishers:
418       - postbuildscript:
419           builders:
420             - role: BOTH
421               build-on:
422                 - ABORTED
423                 - FAILURE
424                 - SUCCESS
425                 - UNSTABLE
426               build-steps:
427                 - shell: |
428                     #!/bin/bash -l
429                     echo "Deleting $STACK_NAME"
430                     openstack stack delete --yes "$STACK_NAME"
431           mark-unstable-if-failed: false
432
433 - builder:
434     name: releng-stage-release
435     builders:
436       - shell: !include-raw: stage-release.sh
437
438 - wrapper:
439     # This wrapper is required for all jobs as it configures the wrappers
440     # needed by OpenDaylight infra.
441     name: opendaylight-infra-wrappers
442     wrappers:
443       - mask-passwords
444       - config-file-provider:
445           files:
446             - file-id: npmrc
447               target: '$HOME/.npmrc'
448             - file-id: pipconf
449               target: '$HOME/.config/pip/pip.conf'
450             - file-id: clouds-yaml
451               target: '$HOME/.config/openstack/clouds.yaml'
452       - timeout:
453           type: absolute
454           timeout: '{build-timeout}'
455           timeout-var: 'BUILD_TIMEOUT'
456           fail: true
457       - timestamps
458       - ssh-agent-credentials:
459           users:
460             - 'opendaylight-jenkins-ssh'
461       - openstack:
462           single-use: true
463
464 - publisher:
465     name: opendaylight-infra-generate-csit-status-report
466     publishers:
467       - postbuildscript:
468           builders:
469             - role: BOTH
470               build-on:
471                 - ABORTED
472                 - FAILURE
473                 - NOT_BUILT
474                 - SUCCESS
475                 - UNSTABLE
476               build-steps:
477                 - shell: !include-raw: generate-csit-status-report.sh
478           mark-unstable-if-failed: true