Bottlenecks: bugfix
[releng.git] / jjb / bottlenecks / bottlenecks-ci-jobs.yml
1 ####################################
2 # job configuration for bottlenecks
3 ####################################
4 - project:
5     name: bottlenecks-ci-jobs
6
7     project: 'bottlenecks'
8
9 #--------------------------------
10 # BRANCH ANCHORS
11 #--------------------------------
12     master: &master
13         stream: master
14         branch: '{stream}'
15         #This is used for common project file storage
16         gs-pathname: ''
17         #This is used for different test suite dependent packages storage
18         gs-packagepath: '/{suite}'
19         #docker tag used for version control
20         docker-tag: 'latest'
21     brahmaputra: &brahmaputra
22         stream: brahmaputra
23         branch: 'stable/{stream}'
24         gs-pathname: '/{stream}'
25         gs-packagepath: '/{stream}/{suite}'
26         docker-tag: 'brahmaputra'
27 #--------------------------------
28 # POD, INSTALLER, AND BRANCH MAPPING
29 #--------------------------------
30 #        brahmaputra
31 #--------------------------------
32     pod:
33         - opnfv-jump-2:
34             installer: fuel
35             <<: *brahmaputra
36         - intel-pod5:
37             installer: joid
38             <<: *brahmaputra
39         - huawei-us-deploy-bare-1:
40             installer: compass
41             <<: *brahmaputra
42 #--------------------------------
43 #        master
44 #--------------------------------
45         - ericsson-pod1:
46             installer: fuel
47             <<: *master
48         - ericsson-pod2:
49             installer: fuel
50             <<: *master
51         - intel-pod6:
52             installer: joid
53             <<: *master
54         - intel-pod8:
55             installer: compass
56             <<: *master
57         - zte-build-1:
58             installer: fuel
59             <<: *master
60         - orange-pod2:
61             installer: joid
62             <<: *master
63 #--------------------------------
64     suite:
65         - 'rubbos'
66         - 'vstf'
67
68     jobs:
69         - 'bottlenecks-{installer}-{suite}-{pod}-daily-{stream}'
70
71 ################################
72 # job templates
73 ################################
74 - job-template:
75     name: 'bottlenecks-{installer}-{suite}-{pod}-daily-{stream}'
76
77     disabled: false
78
79     wrappers:
80         - build-name:
81             name: '$BUILD_NUMBER - Scenario: $DEPLOY_SCENARIO'
82
83     parameters:
84         - project-parameter:
85             project: '{project}'
86         - '{pod}-defaults'
87         - '{installer}-defaults'
88         - 'bottlenecks-params-{pod}'
89         - string:
90             name: REPO_DIR
91             default: "/home/opnfv/bottlenecks"
92             description: "Directory where the repository is cloned"
93         - string:
94             name: DEPLOY_SCENARIO
95             default: 'os-odl_l2-nofeature-ha'
96         - string:
97             name: GERRIT_REFSPEC_DEBUG
98             default: 'false'
99             description: "Gerrit refspec for debug."
100         - string:
101             name: SUITE_NAME
102             default: '{suite}'
103             description: "test suite name."
104         - string:
105             name: DOCKER_TAG
106             default: '{docker-tag}'
107             description: "docker image tag used for version control"
108
109     scm:
110         - git-scm:
111             credentials-id: '{ssh-credentials}'
112             refspec: ''
113             branch: '{branch}'
114
115     builders:
116         - 'bottlenecks-env-cleanup'
117         - 'bottlenecks-fetch-os-creds'
118         - 'bottlenecks-run-suite'
119
120     publishers:
121         - email:
122             recipients: hongbo.tianhongbo@huawei.com matthew.lijun@huawei.com liangqi1@huawei.com sunshine.wang@huawei.com
123
124 ########################
125 # builder macros
126 ########################
127 - builder:
128     name: bottlenecks-fetch-os-creds
129     builders:
130         - shell:
131             !include-raw ../../utils/fetch_os_creds.sh
132
133 - builder:
134     name: bottlenecks-env-cleanup
135     builders:
136         - shell: |
137             #!/bin/bash
138             set -e
139             [[ $GERRIT_REFSPEC_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
140
141             echo "Bottlenecks: docker containers/images cleaning up"
142             if [[ ! -z $(docker ps -a | grep opnfv/bottlenecks) ]]; then
143                 echo "removing existing opnfv/bottlenecks containers"
144                 docker ps -a | grep opnfv/bottlenecks | awk '{print $1}' | xargs docker rm -f >$redirect
145             fi
146
147             if [[ ! -z $(docker images | grep opnfv/bottlenecks) ]]; then
148                 echo "Bottlenecks: docker images to remove:"
149                 docker images | head -1 && docker images | grep opnfv/bottlenecks
150                 image_tags=($(docker images | grep opnfv/bottlenecks | awk '{print $2}'))
151                 for tag in "${image_tags[@]}"; do
152                     echo "Removing docker image opnfv/bottlenecks:$tag..."
153                     docker rmi opnfv/bottlenecks:$tag >$redirect
154                 done
155             fi
156
157 - builder:
158     name: bottlenecks-run-suite
159     builders:
160         - shell: |
161             #!/bin/bash
162             set -e
163             [[ $GERRIT_REFSPEC_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
164
165             echo "Bottlenecks: ${SUITE_NAME} running now..."
166
167             # pull latest image
168             docker pull opnfv/bottlenecks:$DOCKER_TAG >$redirect
169
170             # run tests by using docker
171             opts="--privileged=true --rm"
172             envs="-e INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} \
173                   -e NODE_NAME=${NODE_NAME} -e EXTERNAL_NET=${EXTERNAL_NETWORK} \
174                   -e BOTTLENECKS_BRANCH=${BOTTLENECKS_BRANCH} -e GERRIT_REFSPEC_DEBUG=${GERRIT_REFSPEC_DEBUG} \
175                   -e BOTTLENECKS_DB_TARGET=${BOTTLENECKS_DB_TARGET} -e PACKAGE_URL=${PACKAGE_URL}"
176             run_testsuite="${REPO_DIR}/run_tests.sh -s ${SUITE_NAME}"
177             cmd="sudo docker run ${opts} ${envs} opnfv/bottlenecks ${run_testsuite}"
178             echo "Bottlenecks: docker cmd running: ${cmd}"
179             ${cmd}
180
181 ####################
182 # parameter macros
183 ####################
184
185 - parameter:
186     name: 'bottlenecks-params-intel-pod5'
187     parameters:
188         - string:
189             name: BOTTLENECKS_DB_TARGET
190             default: '213.77.62.197'
191             description: 'Arguments to use in order to choose the backend DB'
192
193 - parameter:
194     name: 'bottlenecks-params-intel-pod6'
195     parameters:
196         - string:
197             name: BOTTLENECKS_DB_TARGET
198             default: '213.77.62.197'
199             description: 'Arguments to use in order to choose the backend DB'
200
201 - parameter:
202     name: 'bottlenecks-params-intel-pod8'
203     parameters:
204         - string:
205             name: BOTTLENECKS_DB_TARGET
206             default: '213.77.62.197'
207             description: 'Arguments to use in order to choose the backend DB'
208
209 - parameter:
210     name: 'bottlenecks-params-ericsson-pod1'
211     parameters:
212         - string:
213             name: BOTTLENECKS_DB_TARGET
214             default: '213.77.62.197'
215             description: 'Arguments to use in order to choose the backend DB'
216
217 - parameter:
218     name: 'bottlenecks-params-ericsson-pod2'
219     parameters:
220         - string:
221             name: BOTTLENECKS_DB_TARGET
222             default: '213.77.62.197'
223             description: 'Arguments to use in order to choose the backend DB'
224
225 - parameter:
226     name: 'bottlenecks-params-opnfv-jump-2'
227     parameters:
228         - string:
229             name: BOTTLENECKS_DB_TARGET
230             default: '213.77.62.197'
231             description: 'Arguments to use in order to choose the backend DB'
232
233 - parameter:
234     name: 'bottlenecks-params-huawei-us-deploy-bare-1'
235     parameters:
236         - string:
237             name: BOTTLENECKS_DB_TARGET
238             default: '213.77.62.197'
239             description: 'Arguments to use in order to choose the backend DB'
240
241 - parameter:
242     name: 'bottlenecks-params-zte-build-1'
243     parameters:
244         - string:
245             name: BOTTLENECKS_DB_TARGET
246             default: '213.77.62.197'
247             description: 'Arguments to use in order to choose the backend DB'
248
249 - parameter:
250     name: 'bottlenecks-params-orange-pod2'
251     parameters:
252         - string:
253             name: BOTTLENECKS_DB_TARGET
254             default: '213.77.62.197'
255             description: 'Arguments to use in order to choose the backend DB'