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