docker: Make it possible to specify tags for Docker Images of test projects
[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         - virtual:
137             installer: joid
138             suite: daily
139             auto-trigger-name: 'brahmaputra-trigger-daily-disabled'
140             <<: *master
141 #--------------------------------
142
143     jobs:
144         - 'yardstick-{installer}-{pod}-{suite}-{stream}'
145
146 ################################
147 # job templates
148 ################################
149 - job-template:
150     name: 'yardstick-{installer}-{pod}-{suite}-{stream}'
151
152     disabled: false
153
154     concurrent: true
155
156     properties:
157         - throttle:
158             enabled: true
159             max-per-node: 1
160
161     wrappers:
162         - build-name:
163             name: '$BUILD_NUMBER - Scenario: $DEPLOY_SCENARIO'
164         - timeout:
165             timeout: 180
166             abort: true
167
168     triggers:
169         - '{auto-trigger-name}'
170
171     parameters:
172         - project-parameter:
173             project: '{project}'
174         - '{pod}-defaults'
175         - '{installer}-defaults'
176         - 'yardstick-params-{pod}'
177         - string:
178             name: DEPLOY_SCENARIO
179             default: 'os-odl_l2-nofeature-ha'
180         - string:
181             name: DOCKER_TAG
182             default: '{docker-tag}'
183             description: 'Tag to pull docker image'
184         - string:
185             name: YARDSTICK_SUITE_NAME
186             default: opnfv_${{NODE_NAME}}_{suite}.yaml
187             description: 'Path to test suite'
188         - string:
189             name: CI_DEBUG
190             default: 'false'
191             description: "Show debut output information"
192
193     scm:
194         - git-scm:
195             credentials-id: '{ssh-credentials}'
196             refspec: ''
197             branch: '{branch}'
198
199     builders:
200         - 'yardstick-cleanup'
201         #- 'yardstick-fetch-os-creds'
202         - 'yardstick-{suite}'
203
204     publishers:
205         - email:
206             recipients: ana.cunha@ericsson.com jorgen.w.karlsson@ericsson.com
207
208 ########################
209 # builder macros
210 ########################
211 - builder:
212     name: yardstick-daily
213     builders:
214         - shell: |
215             #!/bin/bash
216             set -e
217             [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
218
219             # labconfig is used only for joid
220             labconfig=""
221             sshkey=""
222             if [[ ${INSTALLER_TYPE} == 'apex' ]]; then
223                 instack_mac=$(sudo virsh domiflist instack | grep default | \
224                               grep -Eo "[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+")
225                 INSTALLER_IP=$(/usr/sbin/arp -e | grep ${instack_mac} | awk {'print $1'})
226                 sshkey="-v /root/.ssh/id_rsa:/root/.ssh/id_rsa"
227                 if [[ -n $(sudo iptables -L FORWARD |grep "REJECT"|grep "reject-with icmp-port-unreachable") ]]; then
228                     #note: this happens only in opnfv-lf-pod1
229                     sudo iptables -D FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable
230                     sudo iptables -D FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable
231                 fi
232             elif [[ ${INSTALLER_TYPE} == 'joid' ]]; then
233                 # If production lab then creds may be retrieved dynamically
234                 # creds are on the jumphost, always in the same folder
235                 labconfig="-v $LAB_CONFIG/admin-openrc:/home/opnfv/openrc"
236                 # If dev lab, credentials may not be the default ones, just provide a path to put them into docker
237                 # replace the default one by the customized one provided by jenkins config
238             fi
239
240             opts="--privileged=true --rm"
241             envs="-e INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} \
242                 -e NODE_NAME=${NODE_NAME} -e EXTERNAL_NETWORK=${EXTERNAL_NETWORK} \
243                 -e YARDSTICK_BRANCH=${GIT_BRANCH##origin/} -e DEPLOY_SCENARIO=${DEPLOY_SCENARIO}"
244
245             # Pull the latest image
246             docker pull opnfv/yardstick:$DOCKER_TAG >$redirect
247
248             # Run docker
249             cmd="sudo docker run ${opts} ${envs} ${labconfig} ${sshkey} opnfv/yardstick \
250                 run_tests.sh ${YARDSTICK_DB_BACKEND} ${YARDSTICK_SUITE_NAME}"
251             echo "Yardstick: Running docker cmd: ${cmd}"
252             ${cmd}
253
254             echo "Yardstick: done!"
255
256 - builder:
257     name: yardstick-vtcdaily
258     builders:
259         - shell: |
260             #!/bin/bash
261             set -e
262             [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
263
264             cd $WORKSPACE
265             ./ci/apexlake-verify
266
267 - builder:
268     name: yardstick-fetch-os-creds
269     builders:
270         - shell:
271             !include-raw: ../../utils/fetch_os_creds.sh
272
273 - builder:
274     name: yardstick-cleanup
275     builders:
276         - shell: |
277             #!/bin/bash
278             [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
279
280             echo "Cleaning up docker containers/images..."
281             # Remove previous running containers if exist
282             if [[ ! -z $(docker ps -a | grep opnfv/yardstick) ]]; then
283                 echo "Removing existing opnfv/yardstick containers..."
284                 docker ps -a | grep opnfv/yardstick | awk '{print $1}' | xargs docker rm -f >$redirect
285
286             fi
287
288             # Remove existing images if exist
289             if [[ ! -z $(docker images | grep opnfv/yardstick) ]]; then
290                 echo "Docker images to remove:"
291                 docker images | head -1 && docker images | grep opnfv/yardstick
292                 image_tags=($(docker images | grep opnfv/yardstick | awk '{print $2}'))
293                 for tag in "${image_tags[@]}"; do
294                     echo "Removing docker image opnfv/yardstick:$tag..."
295                     docker rmi opnfv/yardstick:$tag >$redirect
296
297                 done
298             fi
299 ########################
300 # parameter macros
301 ########################
302 - parameter:
303     name: 'yardstick-params-intel-pod5'
304     parameters:
305         - string:
306             name: YARDSTICK_DB_BACKEND
307             default: '-i 104.197.68.199:8086'
308             description: 'Arguments to use in order to choose the backend DB'
309
310 - parameter:
311     name: 'yardstick-params-intel-pod6'
312     parameters:
313         - string:
314             name: YARDSTICK_DB_BACKEND
315             default: '-i 104.197.68.199:8086'
316             description: 'Arguments to use in order to choose the backend DB'
317
318 - parameter:
319     name: 'yardstick-params-intel-pod8'
320     parameters:
321         - string:
322             name: YARDSTICK_DB_BACKEND
323             default: ''
324             description: 'Arguments to use in order to choose the backend DB'
325
326 - parameter:
327     name: 'yardstick-params-ericsson-pod1'
328     parameters:
329         - string:
330             name: YARDSTICK_DB_BACKEND
331             default: '-i 104.197.68.199:8086'
332             description: 'Arguments to use in order to choose the backend DB'
333
334 - parameter:
335     name: 'yardstick-params-ericsson-pod2'
336     parameters:
337         - string:
338             name: YARDSTICK_DB_BACKEND
339             default: '-i 104.197.68.199:8086'
340             description: 'Arguments to use in order to choose the backend DB'
341
342 - parameter:
343     name: 'yardstick-params-opnfv-jump-1'
344     parameters:
345         - string:
346             name: YARDSTICK_DB_BACKEND
347             default: '-i 104.197.68.199:8086'
348             description: 'Arguments to use in order to choose the backend DB'
349
350 - parameter:
351     name: 'yardstick-params-opnfv-jump-2'
352     parameters:
353         - string:
354             name: YARDSTICK_DB_BACKEND
355             default: '-i 104.197.68.199:8086'
356             description: 'Arguments to use in order to choose the backend DB'
357
358 - parameter:
359     name: 'yardstick-params-huawei-us-deploy-bare-1'
360     parameters:
361         - string:
362             name: YARDSTICK_DB_BACKEND
363             default: '-i 104.197.68.199:8086'
364             description: 'Arguments to use in order to choose the backend DB'
365
366 - parameter:
367     name: 'yardstick-params-zte-build-1'
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 - parameter:
375     name: 'yardstick-params-orange-pod2'
376     parameters:
377         - string:
378             name: YARDSTICK_DB_BACKEND
379             default: '-i 104.197.68.199:8086'
380             description: 'Arguments to use in order to choose the backend DB'
381
382 - parameter:
383     name: 'yardstick-params-virtual'
384     parameters:
385         - string:
386             name: YARDSTICK_DB_BACKEND
387             default: ''
388             description: 'Arguments to use in order to choose the backend DB'
389
390 - parameter:
391     name: 'yardstick-params-huawei-virtual'
392     parameters:
393         - string:
394             name: YARDSTICK_DB_BACKEND
395             default: ''
396             description: 'Arguments to use in order to choose the backend DB'
397
398 #######################
399 ## trigger macros
400 #######################
401 # trigger for PODs to only run yardstick test suites
402 - trigger:
403     name: 'yardstick-daily-zte-build-1-trigger'
404     triggers:
405         - timed: '0 2 * * *'
406
407 - trigger:
408     name: 'yardstick-vtcdaily-ericsson-pod1-trigger'
409     triggers:
410         - timed: '0 1 * * *'