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