Merge "remove test_cases info in project description"
[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     parameters:
296         - project-parameter:
297             project: '{project}'
298         - functest-parameter:
299             gs-pathname: '{gs-pathname}'
300
301     scm:
302         - git-scm:
303             credentials-id: '{ssh-credentials}'
304             refspec: ''
305             branch: '{stream}'
306
307     triggers:
308         - 'functest-{stream}'
309
310     prebuilders:
311         - test-macro
312
313     builders:
314         - shell:
315             !include-raw ../opnfvdocs/docu-build.sh
316
317     postbuilders:
318         - test-macro
319
320 - job-template:
321     name: 'functest-verify-{stream}'
322
323     logrotate:
324         daysToKeep: 30
325         numToKeep: 10
326         artifactDaysToKeep: -1
327         artifactNumToKeep: -1
328
329     parameters:
330         - project-parameter:
331             project: '{project}'
332         - gerrit-parameter:
333             branch: '{branch}'
334     scm:
335         - gerrit-trigger-scm:
336             credentials-id: '{ssh-credentials}'
337             refspec: '$GERRIT_REFSPEC'
338             choosing-strategy: 'gerrit'
339
340     triggers:
341         - gerrit:
342             trigger-on:
343                 - patchset-created-event:
344                     exclude-drafts: 'false'
345                     exclude-trivial-rebase: 'false'
346                     exclude-no-code-change: 'false'
347                 - draft-published-event
348                 - comment-added-contains-event:
349                     comment-contains-value: 'recheck'
350                 - comment-added-contains-event:
351                     comment-contains-value: 'reverify'
352             projects:
353               - project-compare-type: 'ANT'
354                 project-pattern: 'functest'
355                 branches:
356                   - branch-compare-type: 'ANT'
357                     branch-pattern: '**/{branch}'
358
359     builders:
360         - shell:
361             !include-raw ../opnfvdocs/docu-build.sh
362
363 - job-template:
364     name: 'functest-merge-{stream}'
365
366     # builder-merge job to run JJB update
367     #
368     # This job's purpose is to update all the JJB
369
370     parameters:
371         - project-parameter:
372             project: '{project}'
373         - gerrit-parameter:
374             branch: '{branch}'
375
376     scm:
377         - gerrit-trigger-scm:
378             credentials-id: '{ssh-credentials}'
379             refspec: ''
380             choosing-strategy: 'default'
381
382     triggers:
383         - gerrit:
384             trigger-on:
385                 - change-merged-event
386                 - comment-added-contains-event:
387                     comment-contains-value: 'remerge'
388             projects:
389               - project-compare-type: 'ANT'
390                 project-pattern: 'functest'
391                 branches:
392                     - branch-compare-type: 'ANT'
393                       branch-pattern: '**/{branch}'
394
395     builders:
396         - shell:
397             !include-raw ../opnfvdocs/docu-build.sh
398
399 ########################
400 # parameter macros
401 ########################
402 - parameter:
403     name: functest-parameter
404     parameters:
405         - string:
406             name: GS_PATHNAME
407             default: '{gs-pathname}'
408             description: "Version directory where the opnfv documents will be stored in gs repository"
409         - string:
410             name: FUNCTEST_REPO_DIR
411             default: "/home/opnfv/repos/functest"
412             description: "Directory where the Functest repository is cloned"
413
414 - parameter:
415     name: orange-build
416     parameters:
417         - string:
418             name: GIT_BASE
419             default: https://gerrit.opnfv.org/gerrit/$PROJECT
420             description: "Override GIT_BASE"
421
422 - parameter:
423     name: opnfv-jump-1
424     parameters:
425         - string:
426             name: GIT_BASE
427             default: ssh://gerrit.opnfv.org:29418/$PROJECT
428             description: "Override GIT_BASE"
429
430 - parameter:
431     name: opnfv-jump-2
432     parameters:
433         - string:
434             name: GIT_BASE
435             default: ssh://gerrit.opnfv.org:29418/$PROJECT
436             description: "Override GIT_BASE"
437 ########################
438 # trigger macros
439 ########################
440 - trigger:
441     name: 'functest-master'
442     triggers:
443         - pollscm: "H 9 * * *"
444
445 - trigger:
446     name: 'functest-stable-arno'
447     triggers:
448         - pollscm: "H 21 * * *"
449
450 ########################
451 # builder macros
452 ########################
453 # macros
454 - builder:
455     name: functest-all
456     builders:
457         - shell: |
458             #!/bin/bash
459             set +e
460
461             echo "Functest: running all the tests"
462             cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh"
463             container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
464             docker exec $container_id $cmd
465
466 - builder:
467     name: set-functest-env
468     builders:
469         - shell: |
470             #!/bin/bash
471             set +e
472             if [[ ${INSTALLER_TYPE} == 'apex' ]]; then
473                 INSTALLER_IP=$(cat instack /var/lib/libvirt/dnsmasq/default.leases \
474                     |sed 's/.*192/192/g' | sed 's/\ in.*//g')
475             fi
476             echo "Functest: Start Docker and prepare environment"
477             envs="INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP}"
478             docker pull opnfv/functest:latest_stable
479             echo "Functest: Running docker run command: docker run -i -e $envs opnfv/functest /bin/bash &"
480             docker run -i -e $envs opnfv/functest:latest_stable /bin/bash &
481             docker ps -a
482             sleep 5
483             container_id=$(docker ps | grep 'opnfv/functest:latest_stable' | awk '{print $1}' | head -1)
484             echo "Container ID=${container_id}"
485             if [ -z ${container_id} ]; then
486                 echo "Cannot find opnfv/functest container ID ${container_id}. Please check if it is existing."
487                 docker ps -a
488                 exit 1
489             fi
490             echo "Starting the container: docker start ${container_id}"
491             docker start ${container_id}
492             sleep 5
493             docker ps
494             if [ $(docker ps | grep 'opnfv/functest:latest_stable' | wc -l) == 0 ]; then
495                 echo "The container opnfv/functest with ID=${container_id} has not been properly started. Exiting..."
496                 exit 1
497             fi
498             cmd="${FUNCTEST_REPO_DIR}/docker/prepare_env.sh"
499             echo "Executing command inside the docker: ${cmd}"
500             docker exec ${container_id} ${cmd}
501
502 - builder:
503     name: functest-vping
504     builders:
505         - shell: |
506             #!/bin/bash
507             set +e
508
509             echo "Functest: run vPing"
510             cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh --test vping"
511             container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
512             docker exec $container_id $cmd
513
514 - builder:
515     name: functest-odl
516     builders:
517         - shell: |
518             #!/bin/bash
519             set +e
520
521             echo "Functest: run ODL suite"
522             cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh --test odl"
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-tempest-smoke
528     builders:
529         - shell: |
530             #!/bin/bash
531             set +e
532
533             # tempest
534             echo "Functest: run Tempest suite"
535             cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh --test tempest"
536             container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
537             docker exec $container_id $cmd
538
539 - builder:
540     name: functest-rally-bench
541     builders:
542         - shell: |
543             #!/bin/bash
544             set +e
545
546             echo "Functest: run Functest Rally Bench suites"
547             cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh --test rally"
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-vims
553     builders:
554         - shell: |
555             #!/bin/bash
556             set +e
557
558             echo "Functest: run Functest vIMS test"
559             cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh --test vims"
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-store-results
565     builders:
566         - shell:
567             !include-raw res-build.sh
568
569 - builder:
570     name: functest-cleanup
571     builders:
572         - shell: |
573             #!/bin/bash
574
575             echo "Cleaning up docker containers/images..."
576
577             # Remove previous running containers if exist
578             if [[ ! -z $(docker ps -a | grep opnfv/functest) ]]; then
579                 echo "Removing existing opnfv/functest containers..."
580                 docker ps | grep opnfv/functest | awk '{print $1}' | xargs docker stop
581                 docker ps -a | grep opnfv/functest | awk '{print $1}' | xargs docker rm
582             fi
583
584             # Remove existing images if exist
585             if [[ ! -z $(docker images | grep opnfv/functest) ]]; then
586                 echo "Docker images to remove:"
587                 docker images | head -1 && docker images | grep opnfv/functest
588                 image_tags=($(docker images | grep opnfv/functest | awk '{print $2}'))
589                 for tag in "${image_tags[@]}"; do
590                     echo "Removing docker image opnfv/functest:$tag..."
591                     docker rmi opnfv/functest:$tag
592                 done
593             fi