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