Add distribution diff collection between newly created distribution and latest on...
[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-infra-stack-3-type
221 # Operation: Sets environment and then calls opendaylight-infra-stack to spin
222 #            up csit lab using openstack-heat.
223 # Used by: {project}-csit-* job templates
224
225 - builder:
226     name: integration-infra-stack-3-type
227     builders:
228         - integration-cleanup-workspace
229         - shell: |
230             #!/bin/bash
231             # Setup openstack envirnoment file for use by
232             # the opendaylight-infra-stack macro
233             cat > $WORKSPACE/opendaylight-infra-environment.yaml << EOF
234             parameters:
235                 vm_0_count: {vm_0_count}
236                 vm_0_flavor: {vm_0_flavor}
237                 vm_0_image: {vm_0_image}
238                 vm_1_count: {vm_1_count}
239                 vm_1_flavor: {vm_1_flavor}
240                 vm_1_image: {vm_1_image}
241                 vm_2_count: {vm_2_count}
242                 vm_2_flavor: {vm_2_flavor}
243                 vm_2_image: {vm_2_image}
244             EOF
245             echo "Contents of opendaylight-infra-environment.yaml ..."
246             cat $WORKSPACE/opendaylight-infra-environment.yaml
247         - opendaylight-infra-stack:
248             stack-template: 'csit-3-instance-type.yaml'
249
250 # Macro: integration-get-slave-addresses
251 # Operation: this macro gets the IP addresses of the dynamic vms
252 # Used by: {project}-csit-* job templates
253
254 - builder:
255     name: integration-get-slave-addresses
256     builders:
257         - shell:
258             !include-raw:
259                 - include-raw-integration-get-slave-addresses.sh
260
261 # Macro: integration-get-bundle-vars
262 # Operation: this macro gets all bundle related variables
263 # Used by: {project}-csit-3node-* job templates
264
265 - builder:
266     name: integration-get-bundle-vars
267     builders:
268         - shell:
269             !include-raw:
270                 - include-raw-integration-get-bundle-vars.sh
271
272 # Macro: integration-distribution-check
273 # Operation: this macro deploys the controller with all fetures
274 # Used by: {project}-distribution-check-{stream} job template
275
276 - builder:
277     name: integration-distribution-check
278     builders:
279         - shell:
280             !include-raw:
281                 - include-raw-integration-distribution-check.sh
282
283 # Macro: integration-deploy-controller-verify
284 # Operation: this macro deploys the controller with all fetures
285 # Used by: distribution-deploy-{stream} job template
286
287 - builder:
288     name: integration-deploy-controller-verify
289     builders:
290         - shell:
291             !include-raw:
292                 - include-raw-integration-deploy-controller-verify.sh
293
294 # Macro: integration-deploy-controller-offline
295 # Operation: this macro deploys the controller with no external repo configuration
296 # Used by: integration-distrbution-offline-{stream} job template
297
298 - builder:
299     name: integration-deploy-controller-offline
300     builders:
301         - shell:
302             !include-raw:
303                 - include-raw-integration-deploy-controller-offline.sh
304
305 # Macro: integration-deply-controller-run-test
306 # Operation: this macro deploys single contoller and runs test
307 # Used by: {project}-csit-1node-* job templates
308
309 - builder:
310     name: integration-deploy-controller-run-test
311     builders:
312         - shell:
313             !include-raw:
314                 - include-raw-integration-deploy-controller-run-test.sh
315
316 # Macro: integration-configure-clustering
317 # Operation: this macro configures the clustering
318 # Used by: {project}-csit-3node-* job templates
319
320 - builder:
321     name: integration-configure-clustering
322     builders:
323         - shell:
324             !include-raw:
325                 - include-raw-integration-configure-clustering.sh
326
327 # Macro: integration-start-cluster-run-test
328 # Operation: this macro starts the 3-node cluster and runs test
329 # Used by: {project}-csit-3node-* job templates
330
331 - builder:
332     name: integration-start-cluster-run-test
333     builders:
334         - shell:
335             !include-raw:
336                 - include-raw-integration-start-cluster-run-test.sh
337
338 # Macro: integration-get-bundle-url
339 # Operation: this macro gets the job generated distribution URL from distribution pom.xml
340 # Used by: integration-patch-test-{stream} job template
341
342 - builder:
343     name: integration-get-bundle-url
344     builders:
345         - shell:
346             !include-raw:
347                 - include-raw-integration-get-bundle-url.sh
348
349 # Macro: integration-get-bundle-url-root
350 # Operation: this macro gets the job generated distribution URL from root pom.xml
351 # Used by: distribution-verify-{stream} job template
352
353 - builder:
354     name: integration-get-bundle-url-root
355     builders:
356         - shell:
357             !include-raw:
358                 - include-raw-integration-get-bundle-url-root.sh
359
360 # Macro: integration-install-robotframework
361 # Operation: Installs robotframework using pip to a virtualenv
362 # Used by: {project}-csit-* job templates
363
364 - builder:
365     name: integration-install-robotframework
366     builders:
367         - shell:
368             !include-raw:
369                 - include-raw-integration-install-robotframework.sh
370
371 # Macro: integration-cleanup-tmp
372 # Operation: Cleans up temporary files created by build
373 # Used by: {project}-csit-* job templates
374
375 - builder:
376     name: integration-cleanup-tmp
377     builders:
378         - shell:
379             !include-raw:
380                 - include-raw-integration-cleanup-tmp.sh
381
382 # Macro: integration-multipatch-builder
383 # Operation: checks out multiple patches and builds custom distribution
384 # Used by: integration-multipatch-test-* job templates
385
386 - builder:
387     name: integration-multipatch-builder
388     builders:
389         - shell:
390             !include-raw:
391                 - include-raw-integration-multipatch-distribution-test.sh
392
393 # Macro: integration-cleanup-workspace
394 # Operation: Cleans up files possibly left there by the previous build
395 # Used by: {project}-csit-* job templates
396
397 - builder:
398     name: integration-cleanup-workspace
399     builders:
400         - shell:
401             !include-raw:
402                 - include-raw-integration-cleanup-workspace.sh
403
404 # Macro: integration-rebase-patch
405 # Operation: For cloned project, rebase checked-out Gerrit patch onto $BRANCH.
406 # Used by: integration-patch-distribution-* job template
407
408 - builder:
409     name: integration-rebase-gerrit-patch
410     builders:
411         - shell:
412             !include-raw:
413                 - include-raw-integration-rebase-gerrit-patch.sh
414
415 - builder:
416     name: integration-deploy-openstack-run-test
417     builders:
418         - shell:
419             !include-raw:
420                 - include-raw-integration-deploy-openstack-run-test.sh
421
422 # Macro: integration-list-jobs
423 # Operation: queries Jenkins jobs from jenkins.opendaylight.org and
424 #   writes a list of the jobs corresponding to the search terms to a file.
425 # Used by: builder-merge job template
426 #
427 # This script requires the following JJB variables to be passed in:
428 #   {search_string}     Job type to act as a primary filter (e.g. csit)
429 #   {blacklist}         List of sub-projects to filter out (e.g. longevity)
430 #   {stream}            Development release name (e.g. boron)
431 #   {jobs-filename}     Filename to write list into (e.g. carbon-jobs.lst)
432 # NOTE: Requires xmlstarlet installed on node.
433
434 - builder:
435     name: integration-list-jobs
436     builders:
437         - shell:
438             !include-raw:
439                 - include-raw-integration-list-jobs.sh
440
441 # Macro: integration-replace-block-text
442 # Operation: using starting and ending regex to
443 # replace a block of text in a file with the text in
444 # another file. Regex should be basic and work with sed
445 # Used by: builder-merge job template
446 #
447 # This script requires the following JJB variables to be passed in:
448 #   {starting-regex}
449 #   {ending-regex}
450 #   {file-with-changes-to-insert}
451 #   {file-to-change}
452
453 - builder:
454     name: integration-replace-block-text
455     builders:
456         - shell:
457             !include-raw:
458                 - include-raw-integration-replace-block-text.sh
459
460 # Macro: integration-compare-distributions
461 # Operation: will compare an already created distribtion (probably last
462 # published to nexus) to the current distribution being created.
463 # The comparison is done to find the list of patches that are new to the
464 # current distribtion.
465 # Used by: builder-merge job template
466 #
467 # This script requires the bundle vars that are created by the
468 # get-bundle-vars macro script
469
470
471 - builder:
472     name: integration-compare-distributions
473     builders:
474         - shell:
475             !include-raw:
476                 - include-raw-integration-compare-distributions.sh
477
478 ##############
479 # Publishers #
480 ##############
481
482 # Macro: integration-robot
483 # Operation: this macro publishes robot results
484 # Used by: {project}-csit-* job templates
485
486 - publisher:
487     name: integration-robot
488     publishers:
489         - robot:
490             output-path: ''
491             other-files: ''
492             unstable-threshold: '{unstable-if}'
493             pass-threshold: '{pass-if}'
494             only-critical: false
495
496 - publisher:
497     name: integration-robot-tempest
498     publishers:
499         - robot:
500             output-path: ''
501             other-files:
502                 - tempest_results.html
503             unstable-threshold: '{unstable-if}'
504             pass-threshold: '{pass-if}'
505             only-critical: false
506
507 - publisher:
508     name: integration-csit-archive-build
509     publishers:
510         - postbuildscript:
511             builders:
512                 - shell: |
513                     #!/bin/bash
514                     mkdir -p $WORKSPACE/archives
515                     curl --output robot-plugin.zip "$BUILD_URL/robot/report/*zip*/robot-plugin.zip"
516                     unzip -d $WORKSPACE/archives robot-plugin.zip
517                     mv *log* *.log *.log.gz *.csv *.png $WORKSPACE/archives || true  # Don't fail if file missing
518             script-only-if-succeeded: False
519             script-only-if-failed: False
520             mark-unstable-if-failed: True