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