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