Check if OpenStack credentials are fetched before running Functest
[releng.git] / jjb / functest / functest.yml
1 ###################################
2 # job configuration for functest
3 ###################################
4 - project:
5     name: functest
6
7     installer:
8         - fuel:
9             node: 'opnfv-jump-2'
10             installer_type: 'fuel'
11             installer_ip: '10.20.0.2'
12         - foreman:
13             node: 'opnfv-jump-2'
14             installer_type: 'foreman'
15             installer_ip: '172.30.10.73'
16     pod:
17         - orange-build:
18             node: 'orange-build'
19             installer_type: 'foreman'
20             installer_ip: '172.30.10.73'
21
22     jobs:
23         - 'set-functest-env-{pod}'
24         - 'functest-{pod}'
25         - 'clean-functest-env-{pod}'
26         - 'set-functest-env-{installer}-{stream}'
27         - 'functest-{installer}-{stream}'
28         - 'clean-functest-env-{installer}-{stream}'
29         - 'functest-openstack-bench-test-{pod}'
30         - 'functest-openstack-tempest-smoke-test-{pod}'
31         - 'functest-odl-test-{pod}'
32         - 'functest-vims-test-{pod}'
33         - 'functest-vping-test-{pod}'
34         - 'functest-daily-{stream}'
35         - 'functest-merge-{stream}'
36         - 'functest-verify-{stream}'
37
38     # stream:    branch with - in place of / (eg. stable-arno)
39     # branch:    branch (eg. stable/arno)
40     stream:
41         - master:
42             branch: 'master'
43             gs-pathname: ''
44         - stable-arno:
45             branch: 'stable/arno'
46             gs-pathname: '/arno'
47
48     project: 'functest'
49     somevar: 'foo'
50 ################################
51 # job template
52 ################################
53 - job-template:
54     name: set-functest-env-{pod}
55
56     project-type: freestyle
57
58     node: '{pod}'
59
60     logrotate:
61         daysToKeep: 30
62         numToKeep: 10
63         artifactDaysToKeep: -1
64         artifactNumToKeep: -1
65
66     builders:
67         - shell: |
68             #!/bin/bash
69             set +e
70
71             echo "Functest: prepare Functest environment"
72             mkdir -p $HOME/functest/
73             # source openstack vars
74             if [[ ! -f $HOME/opnfv-openrc.sh ]]; then
75                 echo "Unable to access file $HOME/opnfv-openrc.sh"
76                 exit 1
77             fi
78             source $HOME/opnfv-openrc.sh
79
80             # WORKSPACE is the root of the functest repo
81             # go into WORKSPACE where the functest repo is cloned
82             cd $WORKSPACE
83
84             # prepare
85             echo "Functest: prepare Functest environment"
86             python $WORKSPACE/testcases/config_functest.py --debug $WORKSPACE/ start
87
88 - job-template:
89     name: clean-functest-env-{pod}
90
91     project-type: freestyle
92
93     node: '{pod}'
94
95     logrotate:
96         daysToKeep: 30
97         numToKeep: 10
98         artifactDaysToKeep: -1
99         artifactNumToKeep: -1
100
101     builders:
102         - shell: |
103             #!/bin/bash
104             set +e
105
106             # collect results
107             echo "Functest: copy results and clean Functest environment"
108             mkdir -p $HOME/functest/results
109
110             # save ODL results
111             cp -Rf $WORSPACE/testcases/Controllers/ODL/CI/logs $HOME/functest/results/ODL
112
113             # save tempest.conf for further troubleshooting
114             cp $HOME/.rally/tempest/for-deployment-*/tempest.conf $HOME/functest/results
115
116             # cleanup
117             # source openstack vars
118             source $HOME/opnfv-openrc.sh
119             python $WORKSPACE/testcases/config_functest.py --debug --force $WORKSPACE/ clean
120
121 - job-template:
122     name: set-functest-env-{installer}-{stream}
123
124     project-type: freestyle
125
126     node: '{node}'
127
128     logrotate:
129         daysToKeep: 30
130         numToKeep: 10
131         artifactDaysToKeep: -1
132         artifactNumToKeep: -1
133
134     builders:
135         - shell: |
136             #!/bin/bash
137             set +e
138
139             echo "Functest: prepare Functest environment"
140             mkdir -p $HOME/functest/
141             # source openstack vars
142             if [[ ! -f $HOME/opnfv-openrc.sh ]]; then
143                 echo "Unable to access file $HOME/opnfv-openrc.sh"
144                 exit 1
145             fi
146             source $HOME/opnfv-openrc.sh
147
148             # WORKSPACE is the root of the functest repo
149             # go into WORKSPACE where the functest repo is cloned
150             cd $WORKSPACE
151
152             # prepare
153             echo "Functest: prepare Functest environment"
154             python $WORKSPACE/testcases/config_functest.py --debug $WORKSPACE/ start
155
156 - job-template:
157     name: clean-functest-env-{installer}-{stream}
158
159     project-type: freestyle
160
161     node: '{node}'
162
163     logrotate:
164         daysToKeep: 30
165         numToKeep: 10
166         artifactDaysToKeep: -1
167         artifactNumToKeep: -1
168
169     builders:
170         - shell: |
171             #!/bin/bash
172             set +e
173
174             # collect results
175             echo "Functest: copy results and clean Functest environment"
176             mkdir -p $HOME/functest/results
177
178             # save ODL results
179             cp -Rf $WORSPACE/testcases/Controllers/ODL/CI/logs $HOME/functest/results/ODL
180
181             # save tempest.conf for further troubleshooting
182             cp $HOME/.rally/tempest/for-deployment-*/tempest.conf $HOME/functest/results
183
184             # cleanup
185             # source openstack vars
186             source $HOME/opnfv-openrc.sh
187             python $WORKSPACE/testcases/config_functest.py --debug --force $WORKSPACE/ clean
188
189 - job-template:
190     name: functest-openstack-bench-test-{pod}
191
192     project-type: freestyle
193
194     node: '{pod}'
195
196     logrotate:
197         daysToKeep: 30
198         numToKeep: 10
199         artifactDaysToKeep: -1
200         artifactNumToKeep: -1
201
202     builders:
203         - shell: |
204             #!/bin/bash
205             set +e
206
207             echo "Functest: run Functest Rally Bench suites"
208             python $WORKSPACE/testcases/VIM/OpenStack/CI/libraries/run_rally.py --debug $WORKSPACE/ all
209
210 - job-template:
211     name: functest-openstack-tempest-smoke-test-{pod}
212
213     project-type: freestyle
214
215     node: '{pod}'
216
217     logrotate:
218         daysToKeep: 30
219         numToKeep: 10
220         artifactDaysToKeep: -1
221         artifactNumToKeep: -1
222
223     builders:
224         - shell: |
225             #!/bin/bash
226             set +e
227
228             # tempest
229             echo "Functest: run Tempest suite"
230             rally verify start smoke
231             rally verify list
232
233 - job-template:
234     name: functest-odl-test-{pod}
235
236     project-type: freestyle
237
238     node: '{pod}'
239
240     logrotate:
241         daysToKeep: 30
242         numToKeep: 10
243         artifactDaysToKeep: -1
244         artifactNumToKeep: -1
245
246     builders:
247         - shell: |
248             #!/bin/bash
249             set +e
250
251             echo "Functest: run ODL suite"
252             $WORKSPACE/testcases/Controllers/ODL/CI/start_tests.sh
253
254 - job-template:
255     name: functest-vims-test-{pod}
256
257     project-type: freestyle
258
259     node: '{pod}'
260
261     logrotate:
262         daysToKeep: 30
263         numToKeep: 10
264         artifactDaysToKeep: -1
265         artifactNumToKeep: -1
266
267     builders:
268         - shell: |
269             echo "put your CI scenario here"
270
271
272 - job-template:
273     name: functest-vping-test-{pod}
274
275     project-type: freestyle
276
277     node: '{pod}'
278
279     logrotate:
280         daysToKeep: 30
281         numToKeep: 10
282         artifactDaysToKeep: -1
283         artifactNumToKeep: -1
284
285     builders:
286         - shell: |
287             #!/bin/bash
288             set +e
289
290             # vPing
291             echo "Functest: run vPing"
292             python $WORKSPACE/testcases/vPing/CI/libraries/vPing.py --debug $WORKSPACE/ -r
293
294 - job-template:
295     name: functest-{pod}
296
297     project-type: freestyle
298
299     node: '{pod}'
300
301     parameters:
302         - project-parameter:
303             project: '{project}'
304         - string:
305             name: INSTALLER_TYPE
306             default: '{installer_type}'
307             description: "Installer name that is used for deployment."
308         - string:
309             name: INSTALLER_IP
310             default: '{installer_ip}'
311             description: "Installer IP."
312         - '{pod}'
313
314     scm:
315         - git-scm:
316             credentials-id: '{ssh-credentials}'
317             refspec: ''
318             branch: master
319
320     logrotate:
321         daysToKeep: 30
322         numToKeep: 10
323         artifactDaysToKeep: -1
324         artifactNumToKeep: -1
325
326     builders:
327         - 'functest-fetch-os-creds'
328         - 'functest-all'
329         - 'functest-store-results'
330         - 'functest-cleanup'
331
332 - job-template:
333     name: functest-{installer}-{stream}
334
335     project-type: freestyle
336
337     node: '{node}'
338
339     parameters:
340         - project-parameter:
341             project: '{project}'
342         - string:
343             name: INSTALLER_TYPE
344             default: '{installer_type}'
345             description: "Installer name that is used for deployment."
346         - string:
347             name: INSTALLER_IP
348             default: '{installer_ip}'
349             description: "Installer IP."
350         - string:
351             name: GIT_BASE
352             default: ssh://gerrit.opnfv.org:29418/$PROJECT
353             description: "Override GIT_BASE"
354
355     scm:
356         - git-scm:
357             credentials-id: '{ssh-credentials}'
358             refspec: ''
359             branch: master
360
361     logrotate:
362         daysToKeep: 30
363         numToKeep: 10
364         artifactDaysToKeep: -1
365         artifactNumToKeep: -1
366
367     builders:
368         - 'functest-fetch-os-creds'
369         - 'functest-all'
370         - 'functest-store-results'
371         - 'functest-cleanup'
372
373 - job-template:
374     name: 'functest-daily-{stream}'
375
376     node: master
377
378     # Job template for daily builders
379     #
380     # Required Variables:
381     #     stream:    branch with - in place of / (eg. stable)
382     #     branch:    branch (eg. stable)
383
384     project-type: freestyle
385     varsetabove: '{somevar}'
386
387     logrotate:
388         daysToKeep: '{build-days-to-keep}'
389         numToKeep: '{build-num-to-keep}'
390         artifactDaysToKeep: '{build-artifact-days-to-keep}'
391         artifactNumToKeep: '{build-artifact-num-to-keep}'
392
393     parameters:
394         - project-parameter:
395             project: '{project}'
396         - functest-parameter:
397             gs-pathname: '{gs-pathname}'
398
399     scm:
400         - git-scm:
401             credentials-id: '{ssh-credentials}'
402             refspec: ''
403             branch: '{stream}'
404
405     wrappers:
406         - ssh-agent-credentials:
407             user: '{ssh-credentials}'
408
409     triggers:
410         - 'functest-{stream}'
411
412     prebuilders:
413         - test-macro
414
415     builders:
416         - shell:
417             !include-raw ../opnfvdocs/docu-build.sh
418
419     postbuilders:
420         - test-macro
421
422 - job-template:
423     name: 'functest-verify-{stream}'
424
425     node: master
426
427     project-type: freestyle
428
429     logrotate:
430         daysToKeep: 30
431         numToKeep: 10
432         artifactDaysToKeep: -1
433         artifactNumToKeep: -1
434
435     parameters:
436         - project-parameter:
437             project: '{project}'
438         - gerrit-parameter:
439             branch: '{branch}'
440     scm:
441         - gerrit-trigger-scm:
442             credentials-id: '{ssh-credentials}'
443             refspec: '$GERRIT_REFSPEC'
444             choosing-strategy: 'gerrit'
445
446     wrappers:
447         - ssh-agent-credentials:
448             user: '{ssh-credentials}'
449
450     triggers:
451         - gerrit:
452             trigger-on:
453                 - patchset-created-event:
454                     exclude-drafts: 'false'
455                     exclude-trivial-rebase: 'false'
456                     exclude-no-code-change: 'false'
457                 - draft-published-event
458                 - comment-added-contains-event:
459                     comment-contains-value: 'recheck'
460                 - comment-added-contains-event:
461                     comment-contains-value: 'reverify'
462             projects:
463               - project-compare-type: 'ANT'
464                 project-pattern: 'functest'
465                 branches:
466                   - branch-compare-type: 'ANT'
467                     branch-pattern: '**/{branch}'
468
469     builders:
470         - shell:
471             !include-raw ../opnfvdocs/docu-build.sh
472
473 - job-template:
474     name: 'functest-merge-{stream}'
475
476     node: master
477
478     # builder-merge job to run JJB update
479     #
480     # This job's purpose is to update all the JJB
481
482     project-type: freestyle
483
484     logrotate:
485         daysToKeep: 30
486         numToKeep: 40
487         artifactDaysToKeep: -1
488         artifactNumToKeep: 5
489
490     parameters:
491         - project-parameter:
492             project: '{project}'
493         - gerrit-parameter:
494             branch: '{branch}'
495
496     scm:
497         - gerrit-trigger-scm:
498             credentials-id: '{ssh-credentials}'
499             refspec: ''
500             choosing-strategy: 'default'
501
502     wrappers:
503         - ssh-agent-credentials:
504             user: '{ssh-credentials}'
505
506     triggers:
507         - gerrit:
508             trigger-on:
509                 - change-merged-event
510                 - comment-added-contains-event:
511                     comment-contains-value: 'remerge'
512             projects:
513               - project-compare-type: 'ANT'
514                 project-pattern: 'functest'
515                 branches:
516                     - branch-compare-type: 'ANT'
517                       branch-pattern: '**/{branch}'
518
519     builders:
520         - shell:
521             !include-raw ../opnfvdocs/docu-build.sh
522
523 ########################
524 # parameter macros
525 ########################
526 - parameter:
527     name: functest-parameter
528     parameters:
529         - string:
530             name: GS_PATHNAME
531             default: '{gs-pathname}'
532             description: "Version directory where the opnfv documents will be stored in gs repository"
533
534 - parameter:
535     name: orange-build
536     parameters:
537         - string:
538             name: GIT_BASE
539             default: https://gerrit.opnfv.org/gerrit/$PROJECT
540             description: "Override GIT_BASE"
541
542 - parameter:
543     name: opnfv-jump-1
544     parameters:
545         - string:
546             name: GIT_BASE
547             default: ssh://gerrit.opnfv.org:29418/$PROJECT
548             description: "Override GIT_BASE"
549
550 - parameter:
551     name: opnfv-jump-2
552     parameters:
553         - string:
554             name: GIT_BASE
555             default: ssh://gerrit.opnfv.org:29418/$PROJECT
556             description: "Override GIT_BASE"
557 ########################
558 # trigger macros
559 ########################
560 - trigger:
561     name: 'functest-master'
562     triggers:
563         - pollscm: "H 9 * * *"
564
565 - trigger:
566     name: 'functest-stable-arno'
567     triggers:
568         - pollscm: "H 21 * * *"
569
570 ########################
571 # builder macros
572 ########################
573 # macros
574 - builder:
575     name: functest-all
576     builders:
577         - shell: |
578             #!/bin/bash
579             set +e
580
581             echo "Functest: prepare Functest environment"
582             mkdir -p $HOME/functest/
583
584             # source openstack vars
585             if [ ! -f $HOME/opnfv-openrc.sh ]; then
586                 echo "Credentials file not found in "$HOME/opnfv-openrc.sh
587                 exit 1
588             fi
589             echo "Sourcing the OpenStack credentials in"$HOME/opnfv-openrc.sh
590             source $HOME/opnfv-openrc.sh
591
592             # WORKSPACE is the root of the functest repo
593             # go into WORKSPACE where the functest repo is cloned
594             cd $WORKSPACE
595
596             # prepare
597             echo "Functest: prepare Functest environment"
598             python $WORKSPACE/testcases/config_functest.py --debug $WORKSPACE/ start
599             if [ $? != 0 ]; then
600                 echo "Error when configuring Functest environment"
601                 exit 1
602             fi
603
604             # vPing
605             echo "Functest: run vPing"
606             python $WORKSPACE/testcases/vPing/CI/libraries/vPing.py --debug $WORKSPACE/ -r
607
608             # ODL
609             echo "Functest: run ODL suite"
610             $WORKSPACE/testcases/Controllers/ODL/CI/start_tests.sh
611
612             # rally
613             echo "Functest: run Functest Rally Bench suites"
614             python $WORKSPACE/testcases/VIM/OpenStack/CI/libraries/run_rally.py --debug $WORKSPACE/ all
615
616             # tempest
617             echo "Functest: run Tempest suite"
618             rally verify start smoke
619             rally verify list
620
621             # collect results
622             echo "Functest: copy results and clean Functest environment"
623             mkdir -p $HOME/functest/results
624
625             # save ODL results
626             cp -Rf $WORKSPACE/testcases/Controllers/ODL/CI/logs $HOME/functest/results/ODL
627
628             # save tempest.conf for further troubleshooting
629             cp $HOME/.rally/tempest/for-deployment-*/tempest.conf $HOME/functest/results
630
631 - builder:
632     name: functest-store-results
633     builders:
634         - shell:
635             !include-raw res-build.sh
636
637 - builder:
638     name: functest-cleanup
639     builders:
640         - shell: |
641             #!/bin/bash
642             set +e
643
644             # cleanup
645             source $HOME/opnfv-openrc.sh
646             python $WORKSPACE/testcases/config_functest.py --debug --force $WORKSPACE/ clean
647
648 - builder:
649     name: functest-fetch-os-creds
650     builders:
651         - shell:
652             !include-raw ../../utils/fetch_os_creds.sh