Remove netvirt apex jobs
[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: distribution-branch-to-build-parameter
64     parameters:
65       - string:
66           name: DISTRIBUTION_BRANCH_TO_BUILD
67           default: "master"
68           description: "distribution repo branch to build with"
69
70 - parameter:
71     name: maven-exec
72     parameters:
73       - string:
74           name: MVN
75           default: "/w/tools/hudson.tasks.Maven_MavenInstallation/{maven-version}/bin/mvn"
76           description: "Maven selector to be used by shell scripts"
77
78 - scm:
79     name: git-scm
80     scm:
81       - git:
82           credentials-id: "opendaylight-jenkins-ssh"
83           url: "$GIT_BASE"
84           refspec: ""
85           branches:
86             - "origin/{branch}"
87           skip-tag: true
88           wipe-workspace: true
89
90 - scm:
91     name: git-scm-with-submodules
92     scm:
93       - git:
94           credentials-id: "opendaylight-jenkins-ssh"
95           url: "$GIT_BASE"
96           refspec: ""
97           branches:
98             - "refs/heads/{branch}"
99           skip-tag: true
100           wipe-workspace: true
101           submodule:
102             recursive: true
103
104 - scm:
105     name: gerrit-trigger-scm
106     scm:
107       - git:
108           credentials-id: "opendaylight-jenkins-ssh"
109           url: "$GIT_BASE"
110           refspec: "{refspec}"
111           branches:
112             - "origin/$GERRIT_BRANCH"
113           skip-tag: true
114           choosing-strategy: "{choosing-strategy}"
115
116 # This is a single macro to use for all jobs who vote on every (relevant) patch set.
117 # Only 'recheck' trigger word is supported, it always triggers the full set of relevant jobs,
118 # in order to prevent Jenkins from starting only a subset and still voting Verified+1.
119 # Arguments:
120 #     gerrit-server-name: name of gerrit server to listen to
121 #     project: pattern to match triggering projects
122 #     branch: triggering branch name
123 #     files: pattern to match triggering filepaths
124 - trigger:
125     name: gerrit-trigger-patch-submitted
126     triggers:
127       - gerrit:
128           server-name: "{gerrit-server-name}"
129           trigger-on:
130             - patchset-created-event:
131                 exclude-drafts: true
132                 exclude-trivial-rebase: false
133                 exclude-no-code-change: false
134             - draft-published-event
135             - comment-added-contains-event:
136                 comment-contains-value: '^Patch Set[ ]+[0-9]+:([ ]+|[\n]+)(recheck|reverify)$'
137           projects:
138             - project-compare-type: ANT
139               project-pattern: "{project}"
140               branches:
141                 - branch-compare-type: ANT
142                   branch-pattern: "**/{branch}"
143               file-paths:
144                 - compare-type: ANT
145                   pattern: "{files}"
146               forbidden-file-paths:
147                 - compare-type: ANT
148                   pattern: "{forbidden-files}"
149
150 # TODO: Unify argument names across gerrit-trigger-* macros.
151 - trigger:
152     name: gerrit-trigger-patch-merged
153     triggers:
154       - gerrit:
155           server-name: "{gerrit-server-name}"
156           trigger-on:
157             - change-merged-event
158             - comment-added-contains-event:
159                 comment-contains-value: "remerge$"
160           projects:
161             - project-compare-type: "ANT"
162               project-pattern: "{name}"
163               branches:
164                 - branch-compare-type: "ANT"
165                   branch-pattern: "**/{branch}"
166               file-paths:
167                 - compare-type: ANT
168                   pattern: "{files}"
169               forbidden-file-paths:
170                 - compare-type: ANT
171                   pattern: "{forbidden-files}"
172           skip-vote:
173             successful: true
174             failed: true
175             unstable: true
176             notbuilt: true
177           # Force Jenkins always vote the values it should already have voted
178           # during the prior verify phase
179           override-votes: true
180           gerrit-build-started-verified-value: 1
181           gerrit-build-successful-verified-value: 1
182           gerrit-build-failed-verified-value: 1
183           gerrit-build-unstable-verified-value: 1
184           gerrit-build-notbuilt-verified-value: 1
185           gerrit-build-started-codereview-value: 0
186           gerrit-build-successful-codereview-value: 0
187           gerrit-build-failed-codereview-value: 0
188           gerrit-build-unstable-codereview-value: 0
189           gerrit-build-notbuilt-codereview-value: 0
190
191 - publisher:
192     name: email-notification
193     publishers:
194       - email-ext:
195           recipients: "{email-recipients}"
196           reply-to: ""
197           content-type: default
198           subject: "{email-prefix} $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!"
199           body: |
200             $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
201
202             Please refer to the logs server URL for console logs when possible
203             and use the Jenkins Build URL as a last resort.
204
205             Console Logs URL:
206             https://logs.opendaylight.org/$SILO/$JENKINS_HOSTNAME/$JOB_NAME/$BUILD_NUMBER
207
208             Jenkins Build URL:
209             $BUILD_URL
210           unstable: true
211           fixed: true
212           send-to:
213             - recipients
214
215 - builder:
216     name: opendaylight-infra-stack
217     # opendaylight-infra-stack.sh has a required variable {stack-template} that
218     # must be passed into this macro.
219     builders:
220       - shell: !include-raw: opendaylight-infra-stack.sh
221       - shell: !include-raw-escape: opendaylight-infra-copy-ssh-keys.sh
222
223 - builder:
224     name: distribute-build-url
225     # Place URL of the current run of a build job to a file at given path.
226     builders:
227       - shell: |
228           #!/bin/bash
229           set +e  # DO NOT fail script if command returns non-zero.
230
231           echo "$BUILD_URL" > {path}/build.url
232
233           # DO NOT fail the build if the echo failed.
234           exit 0
235
236 - builder:
237     name: wipe-org-opendaylight-repo
238     builders:
239       - shell: "if [ -d /tmp/r/org/opendaylight ]; then rm -rf /tmp/r/org/opendaylight; fi"
240
241 - builder:
242     name: wipe-local-maven-repo
243     builders:
244       - shell: "if [ -d /tmp/r ]; then rm -rf /tmp/r; fi"
245
246 - wrapper:
247     # This wrapper is required for all jobs as it configures the wrappers
248     # needed by OpenDaylight infra.
249     name: opendaylight-infra-wrappers
250     wrappers:
251       - mask-passwords
252       - config-file-provider:
253           files:
254             - file-id: npmrc
255               target: "$HOME/.npmrc"
256             - file-id: pipconf
257               target: "$HOME/.config/pip/pip.conf"
258             - file-id: clouds-yaml
259               target: "$HOME/.config/openstack/clouds.yaml"
260       - timeout:
261           type: absolute
262           timeout: "{build-timeout}"
263           timeout-var: "BUILD_TIMEOUT"
264           fail: true
265       - timestamps
266       - ssh-agent-credentials:
267           users:
268             - "opendaylight-jenkins-ssh"
269       - openstack:
270           single-use: true
271
272 - publisher:
273     name: opendaylight-infra-generate-csit-status-report
274     publishers:
275       - postbuildscript:
276           builders:
277             - role: BOTH
278               build-on:
279                 - ABORTED
280                 - FAILURE
281                 - NOT_BUILT
282                 - SUCCESS
283                 - UNSTABLE
284               build-steps:
285                 - shell: !include-raw: generate-csit-status-report.sh
286           mark-unstable-if-failed: true