fe6c8987d7e7a561e4e0b1a36ed8431c6774015b
[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     wrappers:
346         - ssh-agent-credentials:
347             user: '{ssh-credentials}'
348
349     triggers:
350         - 'functest-{stream}'
351
352     prebuilders:
353         - test-macro
354
355     builders:
356         - shell:
357             !include-raw ../opnfvdocs/docu-build.sh
358
359     postbuilders:
360         - test-macro
361
362 - job-template:
363     name: 'functest-verify-{stream}'
364
365     node: master
366
367     project-type: freestyle
368
369     logrotate:
370         daysToKeep: 30
371         numToKeep: 10
372         artifactDaysToKeep: -1
373         artifactNumToKeep: -1
374
375     parameters:
376         - project-parameter:
377             project: '{project}'
378         - gerrit-parameter:
379             branch: '{branch}'
380     scm:
381         - gerrit-trigger-scm:
382             credentials-id: '{ssh-credentials}'
383             refspec: '$GERRIT_REFSPEC'
384             choosing-strategy: 'gerrit'
385
386     wrappers:
387         - ssh-agent-credentials:
388             user: '{ssh-credentials}'
389
390     triggers:
391         - gerrit:
392             trigger-on:
393                 - patchset-created-event:
394                     exclude-drafts: 'false'
395                     exclude-trivial-rebase: 'false'
396                     exclude-no-code-change: 'false'
397                 - draft-published-event
398                 - comment-added-contains-event:
399                     comment-contains-value: 'recheck'
400                 - comment-added-contains-event:
401                     comment-contains-value: 'reverify'
402             projects:
403               - project-compare-type: 'ANT'
404                 project-pattern: 'functest'
405                 branches:
406                   - branch-compare-type: 'ANT'
407                     branch-pattern: '**/{branch}'
408
409     builders:
410         - shell:
411             !include-raw ../opnfvdocs/docu-build.sh
412
413 - job-template:
414     name: 'functest-merge-{stream}'
415
416     node: master
417
418     # builder-merge job to run JJB update
419     #
420     # This job's purpose is to update all the JJB
421
422     project-type: freestyle
423
424     logrotate:
425         daysToKeep: 30
426         numToKeep: 40
427         artifactDaysToKeep: -1
428         artifactNumToKeep: 5
429
430     parameters:
431         - project-parameter:
432             project: '{project}'
433         - gerrit-parameter:
434             branch: '{branch}'
435
436     scm:
437         - gerrit-trigger-scm:
438             credentials-id: '{ssh-credentials}'
439             refspec: ''
440             choosing-strategy: 'default'
441
442     wrappers:
443         - ssh-agent-credentials:
444             user: '{ssh-credentials}'
445
446     triggers:
447         - gerrit:
448             trigger-on:
449                 - change-merged-event
450                 - comment-added-contains-event:
451                     comment-contains-value: 'remerge'
452             projects:
453               - project-compare-type: 'ANT'
454                 project-pattern: 'functest'
455                 branches:
456                     - branch-compare-type: 'ANT'
457                       branch-pattern: '**/{branch}'
458
459     builders:
460         - shell:
461             !include-raw ../opnfvdocs/docu-build.sh
462
463 ########################
464 # parameter macros
465 ########################
466 - parameter:
467     name: functest-parameter
468     parameters:
469         - string:
470             name: GS_PATHNAME
471             default: '{gs-pathname}'
472             description: "Version directory where the opnfv documents will be stored in gs repository"
473         - string:
474             name: FUNCTEST_REPO_DIR
475             default: "/home/opnfv/repos/functest"
476             description: "Directory where the Functest repository is cloned"
477
478 - parameter:
479     name: orange-build
480     parameters:
481         - string:
482             name: GIT_BASE
483             default: https://gerrit.opnfv.org/gerrit/$PROJECT
484             description: "Override GIT_BASE"
485
486 - parameter:
487     name: opnfv-jump-1
488     parameters:
489         - string:
490             name: GIT_BASE
491             default: ssh://gerrit.opnfv.org:29418/$PROJECT
492             description: "Override GIT_BASE"
493
494 - parameter:
495     name: opnfv-jump-2
496     parameters:
497         - string:
498             name: GIT_BASE
499             default: ssh://gerrit.opnfv.org:29418/$PROJECT
500             description: "Override GIT_BASE"
501 ########################
502 # trigger macros
503 ########################
504 - trigger:
505     name: 'functest-master'
506     triggers:
507         - pollscm: "H 9 * * *"
508
509 - trigger:
510     name: 'functest-stable-arno'
511     triggers:
512         - pollscm: "H 21 * * *"
513
514 ########################
515 # builder macros
516 ########################
517 # macros
518 - builder:
519     name: functest-all
520     builders:
521         - shell: |
522             #!/bin/bash
523             set +e
524
525             echo "Functest: running all the tests"
526             cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh"
527             container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
528             docker exec $container_id $cmd
529
530
531 - builder:
532     name: set-functest-env
533     builders:
534         - shell: |
535             #!/bin/bash
536             set +e
537             if [[ ${INSTALLER_TYPE} == 'apex' ]]; then
538                 INSTALLER_IP=$(cat instack /var/lib/libvirt/dnsmasq/default.leases \
539                     |sed 's/.*192/192/g' | sed 's/\ in.*//g')
540             fi
541             echo "Functest: Start Docker and prepare environment"
542             envs="INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP}"
543             docker pull opnfv/functest:latest_stable
544             echo "Functest: Running docker run command: docker run -i -e $envs opnfv/functest /bin/bash &"
545             docker run -i -e $envs opnfv/functest /bin/bash &
546             docker ps -a
547             sleep 5
548             container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
549             echo "Container ID=${container_id}"
550             if [ -z ${container_id} ]; then
551                 echo "Cannot find opnfv/functest container ID ${container_id}. Please check if it is existing."
552                 docker ps -a
553                 exit 1
554             fi
555             echo "Starting the container: docker start ${container_id}"
556             docker start ${container_id}
557             sleep 5
558             docker ps
559             if [ $(docker ps | grep opnfv/functest | wc -l) == 0 ]; then
560                 echo "The container opnfv/functest with ID=${container_id} has not been properly started. Exiting..."
561                 exit 1
562             fi
563             cmd="${FUNCTEST_REPO_DIR}/docker/prepare_env.sh"
564             echo "Executing command inside the docker: ${cmd}"
565             docker exec ${container_id} ${cmd}
566
567
568 - builder:
569     name: functest-vping
570     builders:
571         - shell: |
572             #!/bin/bash
573             set +e
574
575             echo "Functest: run vPing"
576             cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh --test vping"
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-odl
582     builders:
583         - shell: |
584             #!/bin/bash
585             set +e
586
587             echo "Functest: run ODL suite"
588             cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh --test odl"
589             container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
590             docker exec $container_id $cmd
591
592 - builder:
593     name: functest-tempest-smoke
594     builders:
595         - shell: |
596             #!/bin/bash
597             set +e
598
599             # tempest
600             echo "Functest: run Tempest suite"
601             cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh --test tempest"
602             container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
603             docker exec $container_id $cmd
604
605
606
607 - builder:
608     name: functest-rally-bench
609     builders:
610         - shell: |
611             #!/bin/bash
612             set +e
613
614             echo "Functest: run Functest Rally Bench suites"
615             cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh --test rally"
616             container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
617             docker exec $container_id $cmd
618
619
620 - builder:
621     name: functest-vims
622     builders:
623         - shell: |
624             #!/bin/bash
625             set +e
626
627             echo "Functest: run Functest vIMS test"
628             cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh --test vims"
629             container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
630             docker exec $container_id $cmd
631
632
633
634 - builder:
635     name: functest-store-results
636     builders:
637         - shell:
638             !include-raw res-build.sh
639
640 - builder:
641     name: functest-cleanup
642     builders:
643         - shell: |
644             #!/bin/bash
645
646             echo "Cleaning up docker containers/images..."
647
648             # Remove previous running containers if exist
649             if [[ ! -z $(docker ps -a | grep opnfv/functest) ]]; then
650                 echo "Removing existing opnfv/functest containers..."
651                 docker ps | grep opnfv/functest | awk '{{print $1}}' | xargs docker stop
652                 docker ps -a | grep opnfv/functest | awk '{{print $1}}' | xargs docker rm
653             fi
654
655
656             # Remove existing images if exist
657             if [[ ! -z $(docker images | grep opnfv/functest) ]]; then
658                 echo "Docker images to remove:"
659                 docker images | head -1 && docker images | grep opnfv/functest
660                 image_tags=($(docker images | grep opnfv/functest | awk '{{print $2}}'))
661                 for tag in "${{image_tags[@]}}"; do
662                     echo "Removing docker image opnfv/functest:$tag..."
663                     docker rmi opnfv/functest:$tag
664                 done
665             fi