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