test: Enable functest and yardstick for joid virtual deploys
[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             suite: daily
29             <<: *brahmaputra
30         - opnfv-jump-2:
31             installer: fuel
32             suite: daily
33             <<: *brahmaputra
34         - intel-pod5:
35             installer: joid
36             suite: daily
37             <<: *brahmaputra
38         - huawei-us-deploy-bare-1:
39             installer: compass
40             suite: daily
41             <<: *brahmaputra
42         - ericsson-pod1:
43             installer: fuel
44             suite: daily
45             <<: *brahmaputra
46         - virtual:
47             installer: fuel
48             suite: daily
49             <<: *brahmaputra
50         - virtual:
51             installer: compass
52             suite: daily
53             <<: *brahmaputra
54         - virtual:
55             installer: joid
56             suite: daily
57             <<: *brahmaputra
58 #--------------------------------
59 #        master
60 #--------------------------------
61         - ericsson-pod1:
62             installer: fuel
63             suite: daily
64             <<: *master
65         - ericsson-pod1:
66             installer: fuel
67             suite: vtcdaily
68             <<: *master
69         - ericsson-pod2:
70             installer: fuel
71             suite: daily
72             <<: *master
73         - intel-pod6:
74             installer: joid
75             suite: daily
76             <<: *master
77         - intel-pod8:
78             installer: compass
79             suite: daily
80             <<: *master
81         - zte-build-1:
82             installer: fuel
83             suite: daily
84             <<: *master
85         - orange-pod2:
86             installer: joid
87             suite: daily
88             <<: *master
89         - opnfv-jump-1:
90             installer: apex
91             suite: daily
92             <<: *master
93         - virtual:
94             installer: fuel
95             suite: daily
96             <<: *master
97         - virtual:
98             installer: compass
99             suite: daily
100             <<: *master
101         - virtual:
102             installer: joid
103             suite: daily
104             <<: *master
105 #--------------------------------
106
107     jobs:
108         - 'yardstick-{installer}-{pod}-{suite}-{stream}'
109
110 ################################
111 # job templates
112 ################################
113 - job-template:
114     name: 'yardstick-{installer}-{pod}-{suite}-{stream}'
115
116     disabled: false
117
118     wrappers:
119         - build-name:
120             name: '$BUILD_NUMBER - Scenario: $DEPLOY_SCENARIO'
121
122     triggers:
123         - 'yardstick-{pod}-trigger'
124
125     parameters:
126         - project-parameter:
127             project: '{project}'
128         - '{pod}-defaults'
129         - '{installer}-defaults'
130         - 'yardstick-params-{pod}'
131         - string:
132             name: DEPLOY_SCENARIO
133             default: 'os-odl_l2-nofeature-ha'
134         - string:
135             name: YARDSTICK_SUITE_NAME
136             default: opnfv_${{NODE_NAME}}_{suite}.yaml
137             description: 'Path to test suite'
138         - string:
139             name: CI_DEBUG
140             default: 'false'
141             description: "Show debut output information"
142
143     scm:
144         - git-scm:
145             credentials-id: '{ssh-credentials}'
146             refspec: ''
147             branch: '{branch}'
148
149     builders:
150         - 'yardstick-cleanup'
151         #- 'yardstick-fetch-os-creds'
152         - 'yardstick-{suite}'
153
154     publishers:
155         - email:
156             recipients: ana.cunha@ericsson.com jorgen.w.karlsson@ericsson.com
157
158 ########################
159 # builder macros
160 ########################
161 - builder:
162     name: yardstick-daily
163     builders:
164         - shell: |
165             #!/bin/bash
166             set -e
167             [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
168
169             # labconfig is used only for joid
170             labconfig=""
171             sshkey=""
172             if [[ ${INSTALLER_TYPE} == 'apex' ]]; then
173                 instack_mac=$(sudo virsh domiflist instack | grep default | \
174                               grep -Eo "[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+")
175                 INSTALLER_IP=$(/usr/sbin/arp -e | grep ${instack_mac} | awk {'print $1'})
176                 sshkey="-v /root/.ssh/id_rsa:/root/.ssh/id_rsa"
177                 if [[ -n $(sudo iptables -L FORWARD |grep "REJECT"|grep "reject-with icmp-port-unreachable") ]]; then
178                     #note: this happens only in opnfv-lf-pod1
179                     sudo iptables -D FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable
180                     sudo iptables -D FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable
181                 fi
182             elif [[ ${INSTALLER_TYPE} == 'joid' ]]; then
183                 # If production lab then creds may be retrieved dynamically
184                 # creds are on the jumphost, always in the same folder
185                 labconfig="-v $LAB_CONFIG/admin-openrc:/home/opnfv/openrc"
186                 # If dev lab, credentials may not be the default ones, just provide a path to put them into docker
187                 # replace the default one by the customized one provided by jenkins config
188             fi
189
190             opts="--privileged=true --rm"
191             envs="-e INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} \
192                 -e NODE_NAME=${NODE_NAME} -e EXTERNAL_NETWORK=${EXTERNAL_NETWORK} \
193                 -e YARDSTICK_BRANCH=${GIT_BRANCH##origin/} -e DEPLOY_SCENARIO=${DEPLOY_SCENARIO}"
194
195             # Pull the latest image
196             docker pull opnfv/yardstick >$redirect
197
198             # Run docker
199             cmd="sudo docker run ${opts} ${envs} ${labconfig} ${sshkey} opnfv/yardstick \
200                 run_tests.sh ${YARDSTICK_DB_BACKEND} ${YARDSTICK_SUITE_NAME}"
201             echo "Yardstick: Running docker cmd: ${cmd}"
202             ${cmd}
203
204             echo "Yardstick: done!"
205
206 - builder:
207     name: yardstick-vtcdaily
208     builders:
209         - shell: |
210             #!/bin/bash
211             set -e
212             [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
213
214             cd $WORKSPACE
215             ./ci/apexlake-verify
216
217 - builder:
218     name: yardstick-fetch-os-creds
219     builders:
220         - shell:
221             !include-raw: ../../utils/fetch_os_creds.sh
222
223 - builder:
224     name: yardstick-cleanup
225     builders:
226         - shell: |
227             #!/bin/bash
228             [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
229
230             echo "Cleaning up docker containers/images..."
231             # Remove previous running containers if exist
232             if [[ ! -z $(docker ps -a | grep opnfv/yardstick) ]]; then
233                 echo "Removing existing opnfv/yardstick containers..."
234                 docker ps -a | grep opnfv/yardstick | awk '{print $1}' | xargs docker rm -f >$redirect
235
236             fi
237
238             # Remove existing images if exist
239             if [[ ! -z $(docker images | grep opnfv/yardstick) ]]; then
240                 echo "Docker images to remove:"
241                 docker images | head -1 && docker images | grep opnfv/yardstick
242                 image_tags=($(docker images | grep opnfv/yardstick | awk '{print $2}'))
243                 for tag in "${image_tags[@]}"; do
244                     echo "Removing docker image opnfv/yardstick:$tag..."
245                     docker rmi opnfv/yardstick:$tag >$redirect
246
247                 done
248             fi
249 ########################
250 # parameter macros
251 ########################
252 - parameter:
253     name: 'yardstick-params-intel-pod5'
254     parameters:
255         - string:
256             name: YARDSTICK_DB_BACKEND
257             default: ''
258             description: 'Arguments to use in order to choose the backend DB'
259
260 - parameter:
261     name: 'yardstick-params-intel-pod6'
262     parameters:
263         - string:
264             name: YARDSTICK_DB_BACKEND
265             default: ''
266             description: 'Arguments to use in order to choose the backend DB'
267
268 - parameter:
269     name: 'yardstick-params-intel-pod8'
270     parameters:
271         - string:
272             name: YARDSTICK_DB_BACKEND
273             default: ''
274             description: 'Arguments to use in order to choose the backend DB'
275
276 - parameter:
277     name: 'yardstick-params-ericsson-pod1'
278     parameters:
279         - string:
280             name: YARDSTICK_DB_BACKEND
281             default: '-i 10.118.36.90:8086'
282             description: 'Arguments to use in order to choose the backend DB'
283
284 - parameter:
285     name: 'yardstick-params-ericsson-pod2'
286     parameters:
287         - string:
288             name: YARDSTICK_DB_BACKEND
289             default: '-i 10.118.36.90:8086'
290             description: 'Arguments to use in order to choose the backend DB'
291
292 - parameter:
293     name: 'yardstick-params-opnfv-jump-1'
294     parameters:
295         - string:
296             name: YARDSTICK_DB_BACKEND
297             default: '-r 213.77.62.197/results'
298             description: 'Arguments to use in order to choose the backend DB'
299
300 - parameter:
301     name: 'yardstick-params-opnfv-jump-2'
302     parameters:
303         - string:
304             name: YARDSTICK_DB_BACKEND
305             default: '-r 213.77.62.197/results'
306             description: 'Arguments to use in order to choose the backend DB'
307
308 - parameter:
309     name: 'yardstick-params-huawei-us-deploy-bare-1'
310     parameters:
311         - string:
312             name: YARDSTICK_DB_BACKEND
313             default: ''
314             description: 'Arguments to use in order to choose the backend DB'
315
316 - parameter:
317     name: 'yardstick-params-zte-build-1'
318     parameters:
319         - string:
320             name: YARDSTICK_DB_BACKEND
321             default: ''
322             description: 'Arguments to use in order to choose the backend DB'
323
324 - parameter:
325     name: 'yardstick-params-orange-pod2'
326     parameters:
327         - string:
328             name: YARDSTICK_DB_BACKEND
329             default: ''
330             description: 'Arguments to use in order to choose the backend DB'
331
332 - parameter:
333     name: 'yardstick-params-virtual'
334     parameters:
335         - string:
336             name: YARDSTICK_DB_BACKEND
337             default: ''
338             description: 'Arguments to use in order to choose the backend DB'
339
340 #######################
341 ## trigger macros
342 #######################
343 # trigger for PODs to only run yardstick test suites
344 - trigger:
345     name: 'yardstick-zte-build-1-trigger'
346     triggers:
347         - timed: '0 2 * * *'
348
349 - trigger:
350     name: 'yardstick-intel-pod5-trigger'
351     triggers:
352         - timed: ''
353
354 - trigger:
355     name: 'yardstick-intel-pod6-trigger'
356     triggers:
357         - timed: ''
358
359 - trigger:
360     name: 'yardstick-intel-pod8-trigger'
361     triggers:
362         - timed: ''
363
364 - trigger:
365     name: 'yardstick-ericsson-pod1-trigger'
366     triggers:
367         - timed: ''
368
369 - trigger:
370     name: 'yardstick-ericsson-pod2-trigger'
371     triggers:
372         - timed: ''
373
374 - trigger:
375     name: 'yardstick-opnfv-jump-1-trigger'
376     triggers:
377         - timed: ''
378
379 - trigger:
380     name: 'yardstick-opnfv-jump-2-trigger'
381     triggers:
382         - timed: ''
383
384 - trigger:
385     name: 'yardstick-huawei-us-deploy-bare-1-trigger'
386     triggers:
387         - timed: ''
388
389 - trigger:
390     name: 'yardstick-orange-pod2-trigger'
391     triggers:
392         - timed: ''
393
394 - trigger:
395     name: 'yardstick-virtual-trigger'
396     triggers:
397         - timed: ''