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