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