Merge "Make distribution test job run daily for active branches"
[releng/builder.git] / jjb / integration / integration-macros.yaml
1 - parameter:
2     name: integration-branch
3     parameters:
4         - string:
5             name: BRANCH
6             default: '{branch}'
7             description: 'Distribution GIT branch'
8
9 - parameter:
10     name: integration-bundleurl
11     parameters:
12         - string:
13             name: BUNDLEURL
14             default: '{bundleurl}'
15             description: 'URL to karaf distribution zip'
16
17 - parameter:
18     name: integration-jdk-version
19     parameters:
20         - string:
21             name: JDKVERSION
22             default: '{jdkversion}'
23             description: 'Parameter to indicate JAVA Version'
24
25 - parameter:
26     name: integration-controller-scope
27     parameters:
28         - string:
29             name: CONTROLLERSCOPE
30             default: '{controller-scope}'
31             description: 'Feature Only or Feature All test'
32
33 - parameter:
34     name: integration-controller-features
35     parameters:
36         - string:
37             name: CONTROLLERFEATURES
38             default: '{controller-features}'
39             description: 'Features to install in the controller separated by comma'
40
41 - parameter:
42     name: integration-distribution-stream
43     parameters:
44         - string:
45             name: DISTROSTREAM
46             default: '{stream}'
47             description: 'Distribution stream string, for suites to know which behavior to expect'
48
49 - parameter:
50     name: integration-stream-test-plan
51     parameters:
52         - string:
53             name: STREAMTESTPLAN
54             default: '{stream-test-plan}'
55             description: 'Stream-specific test plan we will run'
56
57 - parameter:
58     name: integration-test-plan
59     parameters:
60         - string:
61             name: TESTPLAN
62             default: '{test-plan}'
63             description: 'General test plan we will run unless stream-specific one is found'
64
65 - parameter:
66     name: integration-test-options
67     parameters:
68         - string:
69             name: TESTOPTIONS
70             default: '{test-options}'
71             description: 'Robot command options'
72
73 - parameter:
74     name: integration-distribution-git-url
75     parameters:
76         - string:
77             name: DISTROGITURL
78             default: '{git-url}/integration/distribution'
79             description: 'Distribution GIT URL (do not modify)'
80
81 - parameter:
82     name: integration-patch-refspec
83     parameters:
84         - string:
85             name: PATCHREFSPEC
86             default: '{branch}'
87             description: 'Integration Patch Refspec'
88
89 # Macro: integration-gerrit-scm
90 # Operation: this macro downloads a project gerrit
91 # Used by: all csit jobs
92
93 - scm:
94     name: integration-gerrit-scm
95     scm:
96         - git:
97             credentials-id: 'opendaylight-jenkins-ssh'
98             url: '$GIT_BASE'
99             basedir: '{basedir}'
100             refspec: '{refspec}'
101             branches:
102                 - 'origin/{branch}'
103             skip-tag: true
104             choosing-strategy: 'gerrit'
105
106 # Macro: integration-distribution-scm
107 # Operation: this macro downloads the integration/distribution repo using distribution as basedir
108 # Used by: integration-patch-test-{stream} job template
109
110 - scm:
111     name: integration-distribution-scm
112     scm:
113         - git:
114             credentials-id: 'opendaylight-jenkins-ssh'
115             basedir: 'distribution'
116             url: '$DISTROGITURL'
117             refspec: ''
118             branches:
119                 - 'origin/{branch}'
120             skip-tag: true
121
122 # Macro: integration-trigger-patch-submitted
123 # This is a single macro to use for all csit jobs who vote on every (relevant) patch set.
124 # Only 'recheck' trigger word is supported, it always triggers the full set of relevant jobs,
125 # in order to prevent Jenkins from starting only a subset and still voting Verified+1.
126 # Contrary to gerrit-trigger-patch-submitted, this votes +1 also on unstable runs.
127 # Arguments:
128 #     server: name of gerrit server to listen to
129 #     project: pattern to match triggering projects
130 #     branch: triggering branch name
131 #     files: pattern to match triggering filepaths
132 - trigger:
133     name: integration-trigger-patch-submitted
134     triggers:
135         - gerrit:
136             server-name: '{server}'
137             trigger-on:
138                 - patchset-created-event:
139                     exclude-drafts: 'true'
140                     exclude-trivial-rebase: 'false'
141                     exclude-no-code-change: 'true'
142                 - draft-published-event
143                 - comment-added-contains-event:
144                     comment-contains-value: 'recheck'
145             override-votes: true
146             gerrit-build-unstable-verified-value: +1
147             gerrit-build-unstable-codereview-value: 0
148             projects:
149                 - project-compare-type: 'ANT'
150                   project-pattern: '{project}'
151                   branches:
152                       - branch-compare-type: 'ANT'
153                         branch-pattern: '**/{branch}'
154                   file-paths:
155                       - compare-type: 'ANT'
156                         pattern: '{files}'
157
158 # Macro: integration-openstack-controller-mininet
159 # Operation: this macro will spin the controller and mininet vms
160 # Used by: {project}-csit-* job templates
161
162 - wrapper:
163     name: integration-openstack-controller-mininet
164     wrappers:
165       - openstack:
166           instances:
167             - cloud-name: 'ODLRPC'
168               template-name: '{controller-image}'
169               count: '{controller-vms}'
170             - cloud-name: 'ODLRPC'
171               template-name: '{mininet-image}'
172               count: '{mininet-vms}'
173
174 # Macro: integration-openstack-controller-devstack
175 # Operation: this macro will spin the controller and devstack vms
176 # Used by: {project}-csit-openstack job templates
177 - wrapper:
178     name: integration-openstack-controller-devstack
179     wrappers:
180       - openstack:
181           instances:
182             - cloud-name: 'ODLRPC'
183               template-name: '{controller-image}'
184               count: '{controller-vms}'
185             - cloud-name: 'ODLRPC'
186               template-name: '{openstack-image}'
187               count: '{openstack-vms}'
188
189 #################
190 # Shell Scripts #
191 #################
192
193 # Macro: integration-infra-stack
194 # Operation: Sets environment and then calls opendaylight-infra-stack to spin
195 #            up csit lab using openstack-heat.
196 # Used by: {project}-csit-* job templates
197
198 - builder:
199     name: integration-infra-stack
200     builders:
201         - integration-cleanup-workspace
202         - shell: |
203             #!/bin/bash
204             # Setup openstack envirnoment file for use by
205             # the opendaylight-infra-stack macro
206             cat > $WORKSPACE/opendaylight-infra-environment.yaml << EOF
207             parameters:
208                 vm_0_count: {vm_0_count}
209                 vm_0_flavor: {vm_0_flavor}
210                 vm_0_image: {vm_0_image}
211                 vm_1_count: {vm_1_count}
212                 vm_1_flavor: {vm_1_flavor}
213                 vm_1_image: {vm_1_image}
214             EOF
215             echo "Contents of opendaylight-infra-environment.yaml ..."
216             cat $WORKSPACE/opendaylight-infra-environment.yaml
217         - opendaylight-infra-stack:
218             stack-template: '{stack-template}'
219
220 # Macro: integration-get-slave-addresses
221 # Operation: this macro gets the IP addresses of the dynamic vms
222 # Used by: {project}-csit-* job templates
223
224 - builder:
225     name: integration-get-slave-addresses
226     builders:
227         - shell:
228             !include-raw:
229                 - include-raw-integration-get-slave-addresses.sh
230
231 # Macro: integration-get-bundle-vars
232 # Operation: this macro gets all bundle related variables
233 # Used by: {project}-csit-3node-* job templates
234
235 - builder:
236     name: integration-get-bundle-vars
237     builders:
238         - shell:
239             !include-raw:
240                 - include-raw-integration-get-bundle-vars.sh
241
242 # Macro: integration-distribution-check
243 # Operation: this macro deploys the controller with all fetures
244 # Used by: {project}-distribution-check-{stream} job template
245
246 - builder:
247     name: integration-distribution-check
248     builders:
249         - shell:
250             !include-raw:
251                 - include-raw-integration-distribution-check.sh
252
253 # Macro: integration-deploy-controller-verify
254 # Operation: this macro deploys the controller with all fetures
255 # Used by: integration-distribution-deploy-{stream} job template
256
257 - builder:
258     name: integration-deploy-controller-verify
259     builders:
260         - shell:
261             !include-raw:
262                 - include-raw-integration-deploy-controller-verify.sh
263
264 # Macro: integration-deploy-controller-offline
265 # Operation: this macro deploys the controller with no external repo configuration
266 # Used by: integration-distrbution-offline-{stream} job template
267
268 - builder:
269     name: integration-deploy-controller-offline
270     builders:
271         - shell:
272             !include-raw:
273                 - include-raw-integration-deploy-controller-offline.sh
274
275 # Macro: integration-deply-controller-run-test
276 # Operation: this macro deploys single contoller and runs test
277 # Used by: {project}-csit-1node-* job templates
278
279 - builder:
280     name: integration-deploy-controller-run-test
281     builders:
282         - shell:
283             !include-raw:
284                 - include-raw-integration-deploy-controller-run-test.sh
285
286 # Macro: integration-configure-clustering
287 # Operation: this macro configures the clustering
288 # Used by: {project}-csit-3node-* job templates
289
290 - builder:
291     name: integration-configure-clustering
292     builders:
293         - shell:
294             !include-raw:
295                 - include-raw-integration-configure-clustering.sh
296
297 # Macro: integration-start-cluster-run-test
298 # Operation: this macro starts the 3-node cluster and runs test
299 # Used by: {project}-csit-3node-* job templates
300
301 - builder:
302     name: integration-start-cluster-run-test
303     builders:
304         - shell:
305             !include-raw:
306                 - include-raw-integration-start-cluster-run-test.sh
307
308 # Macro: integration-get-bundle-url
309 # Operation: this macro gets the job generated distribution URL from distribution pom.xml
310 # Used by: integration-patch-test-{stream} job template
311
312 - builder:
313     name: integration-get-bundle-url
314     builders:
315         - shell:
316             !include-raw:
317                 - include-raw-integration-get-bundle-url.sh
318
319 # Macro: integration-get-bundle-url-root
320 # Operation: this macro gets the job generated distribution URL from root pom.xml
321 # Used by: integration-distribution-verify-{stream} job template
322
323 - builder:
324     name: integration-get-bundle-url-root
325     builders:
326         - shell:
327             !include-raw:
328                 - include-raw-integration-get-bundle-url-root.sh
329
330 # Macro: integration-install-robotframework
331 # Operation: Installs robotframework using pip to a virtualenv
332 # Used by: {project}-csit-* job templates
333
334 - builder:
335     name: integration-install-robotframework
336     builders:
337         - shell:
338             !include-raw:
339                 - include-raw-integration-install-robotframework.sh
340
341 # Macro: integration-cleanup-tmp
342 # Operation: Cleans up temporary files created by build
343 # Used by: {project}-csit-* job templates
344
345 - builder:
346     name: integration-cleanup-tmp
347     builders:
348         - shell:
349             !include-raw:
350                 - include-raw-integration-cleanup-tmp.sh
351
352 # Macro: integration-multipatch-builder
353 # Operation: checks out multiple patches and builds custom distribution
354 # Used by: integration-multipatch-test-* job templates
355
356 - builder:
357     name: integration-multipatch-builder
358     builders:
359         - shell:
360             !include-raw:
361                 - include-raw-integration-multipatch-distribution-test.sh
362
363 # Macro: integration-cleanup-workspace
364 # Operation: Cleans up files possibly left there by the previous build
365 # Used by: {project}-csit-* job templates
366
367 - builder:
368     name: integration-cleanup-workspace
369     builders:
370         - shell:
371             !include-raw:
372                 - include-raw-integration-cleanup-workspace.sh
373
374 # Macro: integration-rebase-patch
375 # Operation: For cloned project, rebase checked-out Gerrit patch onto $BRANCH.
376 # Used by: integration-patch-distribution-* job template
377
378 - builder:
379     name: integration-rebase-gerrit-patch
380     builders:
381         - shell:
382             !include-raw:
383                 - include-raw-integration-rebase-gerrit-patch.sh
384
385 - builder:
386     name: integration-deploy-openstack-run-test
387     builders:
388         - shell:
389             !include-raw:
390                 - include-raw-integration-deploy-openstack-run-test.sh
391
392 # Macro: integration-list-jobs
393 # Operation: queries Jenkins jobs from jenkins.opendaylight.org and
394 #   writes a list of the jobs corresponding to the search terms to a file.
395 # Used by: builder-merge job template
396 #
397 # This script requires the following JJB variables to be passed in:
398 #   {search_string}     Job type to act as a primary filter (e.g. csit)
399 #   {blacklist}         List of sub-projects to filter out (e.g. longevity)
400 #   {stream}            Development release name (e.g. boron)
401 #   {jobs-filename}     Filename to write list into (e.g. carbon-jobs.lst)
402
403 - builder:
404     name: integration-list-jobs
405     builders:
406         - shell:
407             !include-raw:
408                 - include-raw-integration-list-jobs.sh
409
410 # Macro: integration-replace-block-text
411 # Operation: using starting and ending regex to
412 # replace a block of text in a file with the text in
413 # another file. Regex should be basic and work with sed
414 # Used by: builder-merge job template
415 #
416 # This script requires the following JJB variables to be passed in:
417 #   {starting-regex}
418 #   {ending-regex}
419 #   {file-with-changes-to-insert}
420 #   {file-to-change}
421
422 - builder:
423     name: integration-replace-block-text
424     builders:
425         - shell:
426             !include-raw:
427                 - include-raw-integration-replace-block-text.sh
428
429 ##############
430 # Publishers #
431 ##############
432
433 # Macro: integration-robot
434 # Operation: this macro publishes robot results
435 # Used by: {project}-csit-* job templates
436
437 - publisher:
438     name: integration-robot
439     publishers:
440         - robot:
441             output-path: ''
442             other-files: ''
443             unstable-threshold: '{unstable-if}'
444             pass-threshold: '{pass-if}'
445             only-critical: false
446
447 - publisher:
448     name: integration-robot-tempest
449     publishers:
450         - robot:
451             output-path: ''
452             other-files:
453                 - tempest_results.html
454             unstable-threshold: '{unstable-if}'
455             pass-threshold: '{pass-if}'
456             only-critical: false
457
458 - publisher:
459     name: integration-csit-archive-build
460     publishers:
461         - postbuildscript:
462             builders:
463                 - shell: |
464                     #!/bin/bash
465                     mkdir -p $WORKSPACE/archives
466                     curl --output robot-plugin.zip "$BUILD_URL/robot/report/*zip*/robot-plugin.zip"
467                     unzip -d $WORKSPACE/archives robot-plugin.zip
468                     mv *log* *.log *.log.gz *.csv *.png $WORKSPACE/archives || true  # Don't fail if file missing
469             script-only-if-succeeded: False
470             script-only-if-failed: False
471             mark-unstable-if-failed: True