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