Merge "apex, functest: Passes DEPLOY_SCENARIO to functest"
[releng.git] / jjb / yardstick / yardstick-ci-jobs.yml
1 ###################################
2 # job configuration for functest
3 ###################################
4 - project:
5     name: yardstick
6
7     project: '{name}'
8
9 #--------------------------------
10 # BRANCH ANCHORS
11 #--------------------------------
12     master: &master
13         stream: master
14         branch: '{stream}'
15         gs-pathname: ''
16     brahmaputra: &brahmaputra
17         stream: brahmaputra
18         branch: 'stable/{stream}'
19         gs-pathname: '{stream}'
20 #--------------------------------
21 # POD, INSTALLER, AND BRANCH MAPPING
22 #--------------------------------
23 #        brahmaputra
24 #--------------------------------
25     pod:
26         - opnfv-jump-1:
27             installer: apex
28             <<: *brahmaputra
29         - opnfv-jump-2:
30             installer: fuel
31             <<: *brahmaputra
32         - intel-pod5:
33             installer: joid
34             <<: *brahmaputra
35         - huawei-us-deploy-bare-1:
36             installer: compass
37             <<: *brahmaputra
38 #--------------------------------
39 #        master
40 #--------------------------------
41         - ericsson-pod1:
42             installer: fuel
43             <<: *master
44         - ericsson-pod2:
45             installer: fuel
46             <<: *master
47         - intel-pod6:
48             installer: joid
49             <<: *master
50         - intel-pod8:
51             installer: compass
52             <<: *master
53         - zte-build-1:
54             installer: fuel
55             <<: *master
56         - orange-pod2:
57             installer: joid
58             <<: *master
59         - opnfv-jump-1:
60             installer: apex
61             <<: *master
62 #--------------------------------
63     loop:
64         - daily
65
66     jobs:
67         - 'yardstick-{installer}-{pod}-{loop}-{stream}'
68
69 ################################
70 # job templates
71 ################################
72 - job-template:
73     name: 'yardstick-{installer}-{pod}-{loop}-{stream}'
74
75     disabled: false
76
77     wrappers:
78         - build-name:
79             name: '$BUILD_NUMBER - Scenario: $DEPLOY_SCENARIO'
80
81     parameters:
82         - project-parameter:
83             project: '{project}'
84         - '{pod}-defaults'
85         - '{installer}-defaults'
86         - 'yardstick-params-{pod}'
87         - string:
88             name: YARDSTICK_SUITE_NAME
89             default: opnfv_${{NODE_NAME}}_{loop}.yaml
90             description: 'Path to test suite'
91         - string:
92             name: CI_DEBUG
93             default: 'false'
94             description: "Show debut output information"
95
96     scm:
97         - git-scm:
98             credentials-id: '{ssh-credentials}'
99             refspec: ''
100             branch: '{branch}'
101
102     builders:
103         - 'yardstick-cleanup'
104         #- 'yardstick-fetch-os-creds'
105         - 'yardstick-daily'
106
107     publishers:
108         - email:
109             recipients: ana.cunha@ericsson.com jorgen.w.karlsson@ericsson.com
110
111 ########################
112 # builder macros
113 ########################
114 - builder:
115     name: yardstick-daily
116     builders:
117         - shell: |
118             #!/bin/bash
119             set -e
120             [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
121
122             # labconfig is used only for joid
123             labconfig=""
124             sshkey=""
125             if [[ ${INSTALLER_TYPE} == 'apex' ]]; then
126                 instack_mac=$(sudo virsh domiflist instack | grep default | \
127                               grep -Eo "[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+")
128                 INSTALLER_IP=$(/usr/sbin/arp -e | grep ${instack_mac} | awk {'print $1'})
129                 sshkey="-v /root/.ssh/id_rsa:/root/.ssh/id_rsa"
130                 if [[ -n $(sudo iptables -L FORWARD |grep "REJECT"|grep "reject-with icmp-port-unreachable") ]]; then
131                     #note: this happens only in opnfv-lf-pod1
132                     sudo iptables -D FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable
133                     sudo iptables -D FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable
134                 fi
135             elif [[ ${INSTALLER_TYPE} == 'joid' ]]; then
136                 # If production lab then creds may be retrieved dynamically
137                 # creds are on the jumphost, always in the same folder
138                 labconfig="-v $LAB_CONFIG/admin-openrc:/home/opnfv/openrc"
139                 # If dev lab, credentials may not be the default ones, just provide a path to put them into docker
140                 # replace the default one by the customized one provided by jenkins config
141             fi
142
143             opts="--privileged=true --rm"
144             envs="-e INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} \
145                 -e NODE_NAME=${NODE_NAME} -e EXTERNAL_NETWORK=${EXTERNAL_NETWORK} \
146                 -e YARDSTICK_BRANCH=${GIT_BRANCH##origin/} -e DEPLOY_SCENARIO=${DEPLOY_SCENARIO}"
147
148             # Pull the latest image
149             docker pull opnfv/yardstick >$redirect
150
151             # Run docker
152             cmd="sudo docker run ${opts} ${envs} ${labconfig} ${sshkey} opnfv/yardstick \
153                 run_tests.sh ${YARDSTICK_DB_BACKEND} ${YARDSTICK_SUITE_NAME}"
154             echo "Yardstick: Running docker cmd: ${cmd}"
155             ${cmd}
156
157             echo "Yardstick: done!"
158
159 - builder:
160     name: yardstick-fetch-os-creds
161     builders:
162         - shell:
163             !include-raw: ../../utils/fetch_os_creds.sh
164
165 - builder:
166     name: yardstick-cleanup
167     builders:
168         - shell: |
169             #!/bin/bash
170             [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
171
172             echo "Cleaning up docker containers/images..."
173             # Remove previous running containers if exist
174             if [[ ! -z $(docker ps -a | grep opnfv/yardstick) ]]; then
175                 echo "Removing existing opnfv/yardstick containers..."
176                 docker ps -a | grep opnfv/yardstick | awk '{print $1}' | xargs docker rm -f >$redirect
177
178             fi
179
180             # Remove existing images if exist
181             if [[ ! -z $(docker images | grep opnfv/yardstick) ]]; then
182                 echo "Docker images to remove:"
183                 docker images | head -1 && docker images | grep opnfv/yardstick
184                 image_tags=($(docker images | grep opnfv/yardstick | awk '{print $2}'))
185                 for tag in "${image_tags[@]}"; do
186                     echo "Removing docker image opnfv/yardstick:$tag..."
187                     docker rmi opnfv/yardstick:$tag >$redirect
188
189                 done
190             fi
191 ########################
192 # parameter macros
193 ########################
194 - parameter:
195     name: 'yardstick-params-intel-pod5'
196     parameters:
197         - string:
198             name: YARDSTICK_DB_BACKEND
199             default: ''
200             description: 'Arguments to use in order to choose the backend DB'
201
202 - parameter:
203     name: 'yardstick-params-intel-pod6'
204     parameters:
205         - string:
206             name: YARDSTICK_DB_BACKEND
207             default: ''
208             description: 'Arguments to use in order to choose the backend DB'
209
210 - parameter:
211     name: 'yardstick-params-intel-pod8'
212     parameters:
213         - string:
214             name: YARDSTICK_DB_BACKEND
215             default: ''
216             description: 'Arguments to use in order to choose the backend DB'
217
218 - parameter:
219     name: 'yardstick-params-ericsson-pod1'
220     parameters:
221         - string:
222             name: YARDSTICK_DB_BACKEND
223             default: '-i 10.118.36.90:8086'
224             description: 'Arguments to use in order to choose the backend DB'
225
226 - parameter:
227     name: 'yardstick-params-ericsson-pod2'
228     parameters:
229         - string:
230             name: YARDSTICK_DB_BACKEND
231             default: '-i 10.118.36.90:8086'
232             description: 'Arguments to use in order to choose the backend DB'
233 - parameter:
234     name: 'yardstick-params-opnfv-jump-1'
235     parameters:
236         - string:
237             name: YARDSTICK_DB_BACKEND
238             default: '-r 213.77.62.197/results'
239             description: 'Arguments to use in order to choose the backend DB'
240 - parameter:
241     name: 'yardstick-params-opnfv-jump-2'
242     parameters:
243         - string:
244             name: YARDSTICK_DB_BACKEND
245             default: '-r 213.77.62.197/results'
246             description: 'Arguments to use in order to choose the backend DB'
247
248 - parameter:
249     name: 'yardstick-params-huawei-us-deploy-bare-1'
250     parameters:
251         - string:
252             name: YARDSTICK_DB_BACKEND
253             default: ''
254             description: 'Arguments to use in order to choose the backend DB'
255
256 - parameter:
257     name: 'yardstick-params-zte-build-1'
258     parameters:
259         - string:
260             name: YARDSTICK_DB_BACKEND
261             default: ''
262             description: 'Arguments to use in order to choose the backend DB'
263
264 - parameter:
265     name: 'yardstick-params-orange-pod2'
266     parameters:
267         - string:
268             name: YARDSTICK_DB_BACKEND
269             default: ''
270             description: 'Arguments to use in order to choose the backend DB'