b4365356428fbebc67a5d10c4b871dcf0b2716e5
[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: 'ssh://jenkins-$SILO@git.opendaylight.org:29418/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 # Operation: this macro sets a trigger for patch submitted on a path pattern
124 # Used by: {project}-verify-csit-* job templates
125
126 - trigger:
127     name: integration-trigger-patch-submitted
128     triggers:
129         - gerrit:
130             server-name: 'OpenDaylight'
131             trigger-on:
132                 - patchset-created-event:
133                     exclude-drafts: 'true'
134                     exclude-trivial-rebase: 'false'
135                     exclude-no-code-change: 'true'
136                 - draft-published-event
137                 - comment-added-contains-event:
138                     comment-contains-value: 'recheck'
139                 - comment-added-contains-event:
140                     comment-contains-value: 'reverify'
141             override-votes: true
142             gerrit-build-unstable-verified-value: +1
143             gerrit-build-unstable-codereview-value: 0
144             projects:
145               - project-compare-type: 'ANT'
146                 project-pattern: '{name}'
147                 branches:
148                   - branch-compare-type: 'ANT'
149                     branch-pattern: '**/{branch}'
150                 file-paths:
151                   - compare-type: 'ANT'
152                     pattern: '{pattern}'
153
154 # Macro: integration-trigger-patch-merged
155 # Operation: this macro sets a trigger for patch merged on a path pattern
156 # Used by: not used yet
157
158 - trigger:
159     name: integration-trigger-patch-merged
160     triggers:
161         - gerrit:
162             server-name: 'OpenDaylight'
163             trigger-on:
164                 - change-merged-event
165                 - comment-added-contains-event:
166                     comment-contains-value: 'remerge'
167             projects:
168               - project-compare-type: 'ANT'
169                 project-pattern: '{name}'
170                 branches:
171                   - branch-compare-type: 'ANT'
172                     branch-pattern: '**/{branch}'
173                 file-paths:
174                   - compare-type: 'ANT'
175                     pattern: '{pattern}'
176
177 # Macro: integration-csit-only
178 # Operation: this macro sets a trigger on reverse job list
179 # Used by: csit -only- job templates
180
181 - trigger:
182     name: integration-csit-only
183     triggers:
184         - reverse:
185             jobs: '{jobs}'
186             result: 'success'
187
188 # Macro: integration-csit-all
189 # Operation: this macro sets a periodic trigger
190 # Used by: csit -all- job teamplates
191
192 - trigger:
193     name: integration-csit-all
194     triggers:
195         - timed: 'H H * * *'
196
197 # Macro: integration-jclouds-controller-mininet
198 # Operation: this macro will spin the controller and mininet vms
199 # Used by: {project}-csit-* job templates
200
201 - wrapper:
202     name: integration-jclouds-controller-mininet
203     wrappers:
204       - jclouds:
205           instances:
206             - '{controller-image}':
207                 cloud-name: 'ODLPUB'
208                 count: '{controller-vms}'
209             - '{mininet-image}':
210                 cloud-name: 'ODLPUB'
211                 count: '{mininet-vms}'
212
213 # Macro: integration-openstack-controller-mininet
214 # Operation: this macro will spin the controller and mininet vms
215 # Used by: {project}-csit-* job templates
216
217 - wrapper:
218     name: integration-openstack-controller-mininet
219     wrappers:
220       - openstack:
221           instances:
222             - cloud-name: 'ODLRPC'
223               template-name: '{controller-image}'
224               count: '{controller-vms}'
225             - cloud-name: 'ODLRPC'
226               template-name: '{mininet-image}'
227               count: '{mininet-vms}'
228
229 # Macro: integration-jclouds-controller-devstack
230 # Operation: this macro will spin the controller and devstack vms
231 # Used by: {project}-csit-openstack job templates
232 - wrapper:
233     name: integration-jclouds-controller-devstack
234     wrappers:
235       - jclouds:
236           instances:
237             - '{controller-image}':
238                 cloud-name: 'ODLPUB'
239                 count: '{controller-vms}'
240             - '{openstack-image}':
241                 cloud-name: 'ODLPUB'
242                 count: '{openstack-vms}'
243
244 # Macro: integration-openstack-controller-devstack
245 # Operation: this macro will spin the controller and devstack vms
246 # Used by: {project}-csit-openstack job templates
247 - wrapper:
248     name: integration-openstack-controller-devstack
249     wrappers:
250       - openstack:
251           instances:
252             - cloud-name: 'ODLRPC'
253               template-name: '{controller-image}'
254               count: '{controller-vms}'
255             - cloud-name: 'ODLRPC'
256               template-name: '{openstack-image}'
257               count: '{openstack-vms}'
258
259 # Macro: integration-jclouds-controller-docker
260 # Operation: this macro will sping the controller and docker vms
261 # Used by: {project}-csit-docker job templates
262 - wrapper:
263     name: integration-jclouds-controller-docker
264     wrappers:
265       - jclouds:
266           instances:
267             - '{controller-image}':
268                 cloud-name: 'ODLPUB'
269                 count: '{controller-vms}'
270             - '{docker-image}':
271                 cloud-name: 'ODLPUB'
272                 count: '{docker-vms}'
273
274 #################
275 # Shell Scripts #
276 #################
277
278 # Macro: integration-copy-ssh-keys
279 # Operation: Copy ssh public key used as authentication for robot
280 # Used by: {project}-csit-* job templates
281
282 - builder:
283     name: integration-copy-ssh-keys
284     builders:
285         - shell: |
286             #!/bin/bash
287             function copy-ssh-keys-to-slave() {
288                 RETRIES=30
289                 for j in $(seq 1 $RETRIES); do
290                     if `ssh-copy-id -i /home/jenkins/.ssh/id_rsa.pub "jenkins@${i}" > /dev/null 2>&1`; then
291                         ssh jenkins@${i} 'echo "$(facter ipaddress_eth0) $(/bin/hostname)" | sudo tee -a /etc/hosts'
292                         echo "Successfully copied public keys to slave ${i}"
293                         break
294                     elif [ $j -eq $RETRIES ]; then
295                         echo "SSH not responding on ${i} after $RETIRES tries. Giving up."
296                         exit 1
297                     else
298                         echo "SSH not responding on ${i}. Retrying in 10 seconds..."
299                         sleep 10
300                     fi
301                 done
302             }
303
304             echo "OpenStack IPS are ${JCLOUDS_IPS}"
305
306             IFS=',' read -ra ADDR <<< "${JCLOUDS_IPS}"
307
308             for i in "${ADDR[@]}"; do
309                 copy-ssh-keys-to-slave &
310             done
311
312             wait
313             echo "Copying ssh keys complete."
314
315 # Macro: integration-get-slave-addresses
316 # Operation: this macro gets the IP addresses of the dynamic vms
317 # Used by: {project}-csit-* job templates
318
319 - builder:
320     name: integration-get-slave-addresses
321     builders:
322         - shell:
323             !include-raw:
324                 - include-raw-integration-get-slave-addresses.sh
325
326 # Macro: integration-get-bundle-vars
327 # Operation: this macro gets all bundle related variables
328 # Used by: {project}-csit-3node-* job templates
329
330 - builder:
331     name: integration-get-bundle-vars
332     builders:
333         - shell:
334             !include-raw:
335                 - include-raw-integration-get-bundle-vars.sh
336
337 # Macro: integration-distribution-check
338 # Operation: this macro deploys the controller with all fetures
339 # Used by: {project}-distribution-check-{stream} job template
340
341 - builder:
342     name: integration-distribution-check
343     builders:
344         - shell:
345             !include-raw:
346                 - include-raw-integration-distribution-check.sh
347
348 # Macro: integration-deploy-controller-verify
349 # Operation: this macro deploys the controller with all fetures
350 # Used by: integration-distribution-deploy-{stream} job template
351
352 - builder:
353     name: integration-deploy-controller-verify
354     builders:
355         - shell:
356             !include-raw:
357                 - include-raw-integration-deploy-controller-verify.sh
358
359 # Macro: integration-deploy-controller-offline
360 # Operation: this macro deploys the controller with no external repo configuration
361 # Used by: integration-distrbution-offline-{stream} job template
362
363 - builder:
364     name: integration-deploy-controller-offline
365     builders:
366         - shell:
367             !include-raw:
368                 - include-raw-integration-deploy-controller-offline.sh
369
370 # Macro: integration-deply-controller-run-test
371 # Operation: this macro deploys single contoller and runs test
372 # Used by: {project}-csit-1node-* job templates
373
374 - builder:
375     name: integration-deploy-controller-run-test
376     builders:
377         - shell:
378             !include-raw:
379                 - include-raw-integration-deploy-controller-run-test.sh
380
381 # Macro: integration-configure-clustering
382 # Operation: this macro configures the clustering
383 # Used by: {project}-csit-3node-* job templates
384
385 - builder:
386     name: integration-configure-clustering
387     builders:
388         - shell:
389             !include-raw:
390                 - include-raw-integration-configure-clustering.sh
391
392 # Macro: integration-start-cluster-run-test
393 # Operation: this macro starts the 3-node cluster and runs test
394 # Used by: {project}-csit-3node-* job templates
395
396 - builder:
397     name: integration-start-cluster-run-test
398     builders:
399         - shell:
400             !include-raw:
401                 - include-raw-integration-start-cluster-run-test.sh
402
403 # Macro: integration-get-bundle-url
404 # Operation: this macro gets the job generated distribution URL from distribution pom.xml
405 # Used by: integration-patch-test-{stream} job template
406
407 - builder:
408     name: integration-get-bundle-url
409     builders:
410         - shell:
411             !include-raw:
412                 - include-raw-integration-get-bundle-url.sh
413
414 # Macro: integration-get-bundle-url-root
415 # Operation: this macro gets the job generated distribution URL from root pom.xml
416 # Used by: integration-distribution-verify-{stream} job template
417
418 - builder:
419     name: integration-get-bundle-url-root
420     builders:
421         - shell:
422             !include-raw:
423                 - include-raw-integration-get-bundle-url-root.sh
424
425 # Macro: integration-install-robotframework
426 # Operation: Installs robotframework using pip to a virtualenv
427 # Used by: {project}-csit-* job templates
428
429 - builder:
430     name: integration-install-robotframework
431     builders:
432         - shell:
433             !include-raw:
434                 - include-raw-integration-install-robotframework.sh
435
436 # Macro: integration-cleanup-tmp
437 # Operation: Cleans up temporary files created by build
438 # Used by: {project}-csit-* job templates
439
440 - builder:
441     name: integration-cleanup-tmp
442     builders:
443         - shell:
444             !include-raw:
445                 - include-raw-integration-cleanup-tmp.sh
446
447 # Macro: integration-multipatch-builder
448 # Operation: checks out multiple patches and builds custom distribution
449 # Used by: integration-multipatch-test-* job templates
450
451 - builder:
452     name: integration-multipatch-builder
453     builders:
454         - shell:
455             !include-raw:
456                 - include-raw-integration-multipatch-distribution-test.sh
457
458 # Macro: integration-cleanup-worspace
459 # Operation: Cleans up files possibly left there by the previous build
460 # Used by: {project}-csit-* job templates
461
462 - builder:
463     name: integration-cleanup-workspace
464     builders:
465         - shell:
466             !include-raw:
467                 - include-raw-integration-cleanup-workspace.sh
468
469 # Macro: integration-rebase-patch
470 # Operation: For cloned project, rebase checked-out Gerrit patch onto $BRANCH.
471 # Used by: integration-patch-distribution-* job template
472
473 - builder:
474     name: integration-rebase-gerrit-patch
475     builders:
476         - shell:
477             !include-raw:
478                 - include-raw-integration-rebase-gerrit-patch.sh
479
480 - builder:
481     name: integration-deploy-openstack-run-test
482     builders:
483         - shell:
484             !include-raw:
485                 - include-raw-integration-deploy-openstack-run-test.sh
486 ##############
487 # Publishers #
488 ##############
489
490 # Macro: integration-robot
491 # Operation: this macro publishes robot results
492 # Used by: {project}-csit-* job templates
493
494 - publisher:
495     name: integration-robot
496     publishers:
497         - robot:
498             output-path: ''
499             other-files: ''
500             unstable-threshold: '{unstable-if}'
501             pass-threshold: '{pass-if}'
502             only-critical: false
503
504 - publisher:
505     name: integration-robot-tempest
506     publishers:
507         - robot:
508             output-path: ''
509             other-files:
510                 - tempest_results.html
511             unstable-threshold: '{unstable-if}'
512             pass-threshold: '{pass-if}'
513             only-critical: false
514
515 - publisher:
516     name: integration-csit-archive-build
517     publishers:
518         - postbuildscript:
519             builders:
520                 - shell: |
521                     #!/bin/bash
522                     mkdir $WORKSPACE/archives
523                     curl --output robot-plugin.zip "$BUILD_URL/robot/report/*zip*/robot-plugin.zip"
524                     unzip -d $WORKSPACE/archives robot-plugin.zip
525                     mv *log* *.log *.csv *.png $WORKSPACE/archives || true  # Don't fail if file missing
526             script-only-if-succeeded: False
527             script-only-if-failed: False
528             mark-unstable-if-failed: True