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