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