Move artifact storage and cleanup to their own macros
[releng.git] / jjb / functest / functest.yml
1 ###################################
2 # job configuration for functest
3 ###################################
4 - project:
5     name: functest
6
7     pod:
8         - 'opnfv-jump-1'
9         - 'opnfv-jump-2'
10     jobs:
11         - 'functest-{pod}'
12         - 'set-functest-env-{pod}'
13         - 'clean-functest-env-{pod}'
14         - 'functest-openstack-bench-test-{pod}'
15         - 'functest-openstack-tempest-smoke-test-{pod}'
16         - 'functest-odl-test-{pod}'
17         - 'functest-vims-test-{pod}'
18         - 'functest-vping-test-{pod}'
19         - 'functest-daily-{stream}'
20         - 'functest-merge'
21         - 'functest-verify-{stream}'
22
23     # stream:    branch with - in place of / (eg. stable-arno)
24     # branch:    branch (eg. stable/arno)
25     stream:
26         - master:
27             branch: 'master'
28             gs-pathname: ''
29         - stable-arno:
30             branch: 'stable/arno'
31             gs-pathname: '/arno'
32
33     project: 'functest'
34     somevar: 'foo'
35 ################################
36 # job template
37 ################################
38 - job-template:
39     name: set-functest-env-{pod}
40
41     project-type: freestyle
42
43     node: '{pod}'
44
45     logrotate:
46         daysToKeep: 30
47         numToKeep: 10
48         artifactDaysToKeep: -1
49         artifactNumToKeep: -1
50
51     builders:
52         - shell: |
53             #!/bin/bash
54             set +e
55
56             echo "Functest: prepare Functest environment"
57             mkdir -p $HOME/functest/
58             source $HOME/functest/opnfv-openrc.sh
59
60             # WORKSPACE is the root of the functest repo
61             # go into WORKSPACE where the functest repo is cloned
62             cd $WORKSPACE
63
64             # prepare
65             echo "Functest: prepare Functest environment"
66             python $WORKSPACE/testcases/config_functest.py --debug $WORKSPACE/ start
67             
68 - job-template:
69     name: clean-functest-env-{pod}
70
71     project-type: freestyle
72
73     node: '{pod}'
74
75     logrotate:
76         daysToKeep: 30
77         numToKeep: 10
78         artifactDaysToKeep: -1
79         artifactNumToKeep: -1
80
81     builders:
82         - shell: |
83             #!/bin/bash
84             set +e
85
86             # collect results
87             echo "Functest: copy results and clean Functest environment"
88             mkdir -p $HOME/functest/results
89
90             # save ODL results
91             cp -Rf $WORSPACE/testcases/Controllers/ODL/CI/logs $HOME/functest/results/ODL
92
93             # save tempest.conf for further troubleshooting
94             cp $HOME/.rally/tempest/for-deployment-*/tempest.conf $HOME/functest/results
95
96             # cleanup
97             python $WORKSPACE/testcases/config_functest.py --debug --force $WORKSPACE/ clean
98
99 - job-template:
100     name: functest-openstack-bench-test-{pod}
101
102     project-type: freestyle
103
104     node: '{pod}'
105
106     logrotate:
107         daysToKeep: 30
108         numToKeep: 10
109         artifactDaysToKeep: -1
110         artifactNumToKeep: -1
111
112     builders:
113         - shell: |
114             #!/bin/bash
115             set +e
116
117             echo "Functest: run Functest Rally Bench suites"
118             python $WORKSPACE/testcases/VIM/OpenStack/CI/libraries/run_rally.py --debug $WORKSPACE/ all
119
120 - job-template:
121     name: functest-openstack-tempest-smoke-test-{pod}
122
123     project-type: freestyle
124
125     node: '{pod}'
126
127     logrotate:
128         daysToKeep: 30
129         numToKeep: 10
130         artifactDaysToKeep: -1
131         artifactNumToKeep: -1
132
133     builders:
134         - shell: |
135             #!/bin/bash
136             set +e
137
138             # tempest
139             echo "Functest: run Tempest suite"
140             rally verify start smoke
141             rally verify list
142
143 - job-template:
144     name: functest-odl-test-{pod}
145
146     project-type: freestyle
147
148     node: '{pod}'
149
150     logrotate:
151         daysToKeep: 30
152         numToKeep: 10
153         artifactDaysToKeep: -1
154         artifactNumToKeep: -1
155
156     builders:
157         - shell: |
158             #!/bin/bash
159             set +e
160
161             echo "Functest: run ODL suite"
162             $WORKSPACE/testcases/Controllers/ODL/CI/start_tests.sh
163
164 - job-template:
165     name: functest-vims-test-{pod}
166
167     project-type: freestyle
168
169     node: '{pod}'
170
171     logrotate:
172         daysToKeep: 30
173         numToKeep: 10
174         artifactDaysToKeep: -1
175         artifactNumToKeep: -1
176
177     builders:
178         - shell: |
179             echo "put your CI scenario here"
180
181
182 - job-template:
183     name: functest-vping-test-{pod}
184
185     project-type: freestyle
186
187     node: '{pod}'
188
189     logrotate:
190         daysToKeep: 30
191         numToKeep: 10
192         artifactDaysToKeep: -1
193         artifactNumToKeep: -1
194
195     builders:
196         - shell: |
197             #!/bin/bash
198             set +e
199
200             # vPing
201             echo "Functest: run vPing"
202             python $WORKSPACE/testcases/vPing/CI/libraries/vPing.py --debug $WORKSPACE/
203
204 - job-template:
205     name: functest-{pod}
206
207     project-type: freestyle
208
209     node: '{pod}'
210
211     parameters:
212         - project-parameter:
213             project: '{project}'
214
215     scm:
216         - git-scm:
217             credentials-id: '{ssh-credentials}'
218             refspec: ''
219             branch: master
220
221     logrotate:
222         daysToKeep: 30
223         numToKeep: 10
224         artifactDaysToKeep: -1
225         artifactNumToKeep: -1
226
227     builders:
228         - 'functest-all'
229         - 'functest-store-results'
230         - 'functest-cleanup'
231
232 - job-template:
233     name: 'functest-daily-{stream}'
234
235     node: master
236
237     # Job template for daily builders
238     #
239     # Required Variables:
240     #     stream:    branch with - in place of / (eg. stable)
241     #     branch:    branch (eg. stable)
242
243     project-type: freestyle
244     varsetabove: '{somevar}'
245
246     logrotate:
247         daysToKeep: '{build-days-to-keep}'
248         numToKeep: '{build-num-to-keep}'
249         artifactDaysToKeep: '{build-artifact-days-to-keep}'
250         artifactNumToKeep: '{build-artifact-num-to-keep}'
251
252     parameters:
253         - project-parameter:
254             project: '{project}'
255         - functest-parameter:
256             gs-pathname: '{gs-pathname}'
257
258     scm:
259         - git-scm:
260             credentials-id: '{ssh-credentials}'
261             refspec: ''
262             branch: '{stream}'
263
264     wrappers:
265         - ssh-agent-credentials:
266             user: '{ssh-credentials}'
267
268     triggers:
269         - 'functest-{stream}'
270
271     prebuilders:
272         - test-macro
273
274     builders:
275         - shell:
276             !include-raw ../opnfvdocs/docu-build.sh
277
278     postbuilders:
279         - test-macro
280
281 - job-template:
282     name: 'functest-verify-{stream}'
283
284     node: master
285
286     project-type: freestyle
287
288     logrotate:
289         daysToKeep: 30
290         numToKeep: 10
291         artifactDaysToKeep: -1
292         artifactNumToKeep: -1
293
294     parameters:
295         - project-parameter:
296             project: '{project}'
297         - gerrit-parameter:
298             branch: '{branch}'
299     scm:
300         - gerrit-trigger-scm:
301             credentials-id: '{ssh-credentials}'
302             refspec: '$GERRIT_REFSPEC'
303             choosing-strategy: 'gerrit'
304
305     wrappers:
306         - ssh-agent-credentials:
307             user: '{ssh-credentials}'
308
309     triggers:
310         - gerrit:
311             trigger-on:
312                 - patchset-created-event:
313                     exclude-drafts: 'false'
314                     exclude-trivial-rebase: 'false'
315                     exclude-no-code-change: 'false'
316                 - draft-published-event
317                 - comment-added-contains-event:
318                     comment-contains-value: 'recheck'
319                 - comment-added-contains-event:
320                     comment-contains-value: 'reverify'
321             projects:
322               - project-compare-type: 'ANT'
323                 project-pattern: 'functest'
324                 branches:
325                   - branch-compare-type: 'ANT'
326                     branch-pattern: '**/{branch}'
327
328     builders:
329         - shell:
330             !include-raw ../opnfvdocs/docu-build.sh
331
332 - job-template:
333     name: 'functest-merge'
334
335     node: master
336
337     # builder-merge job to run JJB update
338     #
339     # This job's purpose is to update all the JJB
340
341     project-type: freestyle
342
343     logrotate:
344         daysToKeep: 30
345         numToKeep: 40
346         artifactDaysToKeep: -1
347         artifactNumToKeep: 5
348
349     parameters:
350         - project-parameter:
351             project: '{project}'
352         - gerrit-parameter:
353             branch: 'master'
354
355     scm:
356         - gerrit-trigger-scm:
357             credentials-id: '{ssh-credentials}'
358             refspec: ''
359             choosing-strategy: 'default'
360
361     wrappers:
362         - ssh-agent-credentials:
363             user: '{ssh-credentials}'
364
365     triggers:
366         - gerrit:
367             trigger-on:
368                 - change-merged-event
369                 - comment-added-contains-event:
370                     comment-contains-value: 'remerge'
371             projects:
372               - project-compare-type: 'ANT'
373                 project-pattern: 'functest'
374                 branches:
375                     - branch-compare-type: 'ANT'
376                       branch-pattern: '**/master'
377
378     builders:
379         - shell:
380             !include-raw ../opnfvdocs/docu-build.sh
381
382 ########################
383 # parameter macros
384 ########################
385 - parameter:
386     name: functest-parameter
387     parameters:
388         - string:
389             name: GS_PATHNAME
390             default: '{gs-pathname}'
391             description: "Version directory where the opnfv documents will be stored in gs repository"
392
393 ########################
394 # trigger macros
395 ########################
396 - trigger:
397     name: 'functest-master'
398     triggers:
399         - pollscm: "H 9 * * *"
400
401 - trigger:
402     name: 'functest-stable-arno'
403     triggers:
404         - pollscm: "H 21 * * *"
405
406 # macros
407 - builder:
408     name: functest-all
409     builders:
410         - shell: |
411             #!/bin/bash
412             set +e
413
414             echo "Functest: prepare Functest environment"
415             mkdir -p $HOME/functest/
416             source $HOME/functest/opnfv-openrc.sh
417
418             # WORKSPACE is the root of the functest repo
419             # go into WORKSPACE where the functest repo is cloned
420             cd $WORKSPACE
421
422             # prepare
423             echo "Functest: prepare Functest environment"
424             python $WORKSPACE/testcases/config_functest.py --debug $WORKSPACE/ start
425
426             # vPing
427             echo "Functest: run vPing"
428             python $WORKSPACE/testcases/vPing/CI/libraries/vPing.py --debug $WORKSPACE/
429
430             # ODL
431             echo "Functest: run ODL suite"
432             $WORKSPACE/testcases/Controllers/ODL/CI/start_tests.sh
433
434             # rally
435             echo "Functest: run Functest Rally Bench suites"
436             python $WORKSPACE/testcases/VIM/OpenStack/CI/libraries/run_rally.py --debug $WORKSPACE/ all
437
438             # tempest
439             echo "Functest: run Tempest suite"
440             rally verify start smoke
441             rally verify list
442
443             # collect results
444             echo "Functest: copy results and clean Functest environment"
445             mkdir -p $HOME/functest/results
446
447             # save ODL results
448             cp -Rf $WORSPACE/testcases/Controllers/ODL/CI/logs $HOME/functest/results/ODL
449
450             # save tempest.conf for further troubleshooting
451             cp $HOME/.rally/tempest/for-deployment-*/tempest.conf $HOME/functest/results
452
453 - builder:
454     name: functest-store-results
455     builders:
456         - shell:
457             !include-raw res-build.sh
458
459 - builder:
460     name: functest-cleanup
461     builders:
462         - shell:
463         - shell: |
464             #!/bin/bash
465             set +e
466
467             # cleanup
468             python $WORKSPACE/testcases/config_functest.py --debug --force $WORKSPACE/ clean