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