add a LF pod for integration and test workflow improvement
[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: 'stable'
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         - opnfv-jump-2:
46             installer: fuel
47             <<: *master
48         - ericsson-pod1:
49             installer: fuel
50             <<: *master
51         - ericsson-pod2:
52             installer: fuel
53             <<: *master
54         - intel-pod6:
55             installer: joid
56             <<: *master
57         - intel-pod8:
58             installer: compass
59             <<: *master
60         - zte-build-1:
61             installer: fuel
62             <<: *master
63         - orange-pod2:
64             installer: joid
65             <<: *master
66 #--------------------------------
67     suite:
68         - 'rubbos'
69         - 'vstf'
70
71     jobs:
72         - 'bottlenecks-{installer}-{suite}-{pod}-daily-{stream}'
73
74 ################################
75 # job templates
76 ################################
77 - job-template:
78     name: 'bottlenecks-{installer}-{suite}-{pod}-daily-{stream}'
79
80     disabled: false
81
82     wrappers:
83         - build-name:
84             name: '$BUILD_NUMBER - Scenario: $DEPLOY_SCENARIO'
85
86     parameters:
87         - project-parameter:
88             project: '{project}'
89         - '{pod}-defaults'
90         - '{installer}-defaults'
91         - 'bottlenecks-params-{pod}'
92         - string:
93             name: REPO_DIR
94             default: "/home/opnfv/bottlenecks"
95             description: "Directory where the repository is cloned"
96         - string:
97             name: DEPLOY_SCENARIO
98             default: 'os-odl_l2-nofeature-ha'
99         - string:
100             name: GERRIT_REFSPEC_DEBUG
101             default: 'false'
102             description: "Gerrit refspec for debug."
103         - string:
104             name: SUITE_NAME
105             default: '{suite}'
106             description: "test suite name."
107         - string:
108             name: DOCKER_TAG
109             default: '{docker-tag}'
110             description: "docker image tag used for version control"
111
112     scm:
113         - git-scm:
114             credentials-id: '{ssh-credentials}'
115             refspec: ''
116             branch: '{branch}'
117
118     builders:
119         - 'bottlenecks-env-cleanup'
120         - 'bottlenecks-run-suite'
121
122     publishers:
123         - email:
124             recipients: hongbo.tianhongbo@huawei.com matthew.lijun@huawei.com liangqi1@huawei.com sunshine.wang@huawei.com
125
126 ########################
127 # builder macros
128 ########################
129 - builder:
130     name: bottlenecks-env-cleanup
131     builders:
132         - shell: |
133             #!/bin/bash
134             set -e
135             [[ $GERRIT_REFSPEC_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
136
137             echo "Bottlenecks: docker containers/images cleaning up"
138             if [[ ! -z $(docker ps -a | grep opnfv/bottlenecks) ]]; then
139                 echo "removing existing opnfv/bottlenecks containers"
140                 docker ps -a | grep opnfv/bottlenecks | awk '{print $1}' | xargs docker rm -f >$redirect
141             fi
142
143             if [[ ! -z $(docker images | grep opnfv/bottlenecks) ]]; then
144                 echo "Bottlenecks: docker images to remove:"
145                 docker images | head -1 && docker images | grep opnfv/bottlenecks
146                 image_tags=($(docker images | grep opnfv/bottlenecks | awk '{print $2}'))
147                 for tag in "${image_tags[@]}"; do
148                     echo "Removing docker image opnfv/bottlenecks:$tag..."
149                     docker rmi opnfv/bottlenecks:$tag >$redirect
150                 done
151             fi
152
153 - builder:
154     name: bottlenecks-run-suite
155     builders:
156         - shell: |
157             #!/bin/bash
158             set -e
159             [[ $GERRIT_REFSPEC_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
160
161             echo "Bottlenecks: to pull image opnfv/bottlenecks:${DOCKER_TAG}"
162             docker pull opnfv/bottlenecks:$DOCKER_TAG >${redirect}
163
164             echo "Bottlenecks: docker start running"
165             opts="--privileged=true -id"
166             envs="-e INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} \
167                   -e NODE_NAME=${NODE_NAME} -e EXTERNAL_NET=${EXTERNAL_NETWORK} \
168                   -e BOTTLENECKS_BRANCH=${BOTTLENECKS_BRANCH} -e GERRIT_REFSPEC_DEBUG=${GERRIT_REFSPEC_DEBUG} \
169                   -e BOTTLENECKS_DB_TARGET=${BOTTLENECKS_DB_TARGET} -e PACKAGE_URL=${PACKAGE_URL}"
170             cmd="sudo docker run ${opts} ${envs} opnfv/bottlenecks:${DOCKER_TAG} /bin/bash"
171             echo "Bottlenecks: docker cmd running ${cmd}"
172             ${cmd} >${redirect}
173
174             echo "Bottlenecks: obtain docker id"
175             container_id=$(docker ps | grep "opnfv/bottlenecks:${DOCKER_TAG}" | awk '{print $1}' | head -1)
176             if [ -z ${container_id} ]; then
177                 echo "Cannot find opnfv/bottlenecks container ID ${container_id}. Please check if it exists."
178                 docker ps -a
179                 exit 1
180             fi
181
182             echo "Bottlenecks: to prepare openstack environment"
183             prepare_env="${REPO_DIR}/ci/prepare_env.sh"
184             echo "Bottlenecks: docker cmd running: ${prepare_env}"
185             sudo docker exec ${container_id} ${prepare_env}
186
187             echo "Bottlenecks: to run testsuite ${SUITE_NAME}"
188             run_testsuite="${REPO_DIR}/run_tests.sh -s ${SUITE_NAME}"
189             echo "Bottlenecks: docker cmd running: ${run_testsuite}"
190             sudo docker exec ${container_id} ${run_testsuite}
191
192 ####################
193 # parameter macros
194 ####################
195
196 - parameter:
197     name: 'bottlenecks-params-intel-pod5'
198     parameters:
199         - string:
200             name: BOTTLENECKS_DB_TARGET
201             default: '213.77.62.197'
202             description: 'Arguments to use in order to choose the backend DB'
203
204 - parameter:
205     name: 'bottlenecks-params-intel-pod6'
206     parameters:
207         - string:
208             name: BOTTLENECKS_DB_TARGET
209             default: '213.77.62.197'
210             description: 'Arguments to use in order to choose the backend DB'
211
212 - parameter:
213     name: 'bottlenecks-params-intel-pod8'
214     parameters:
215         - string:
216             name: BOTTLENECKS_DB_TARGET
217             default: '213.77.62.197'
218             description: 'Arguments to use in order to choose the backend DB'
219
220 - parameter:
221     name: 'bottlenecks-params-ericsson-pod1'
222     parameters:
223         - string:
224             name: BOTTLENECKS_DB_TARGET
225             default: '213.77.62.197'
226             description: 'Arguments to use in order to choose the backend DB'
227
228 - parameter:
229     name: 'bottlenecks-params-ericsson-pod2'
230     parameters:
231         - string:
232             name: BOTTLENECKS_DB_TARGET
233             default: '213.77.62.197'
234             description: 'Arguments to use in order to choose the backend DB'
235
236 - parameter:
237     name: 'bottlenecks-params-opnfv-jump-2'
238     parameters:
239         - string:
240             name: BOTTLENECKS_DB_TARGET
241             default: '213.77.62.197'
242             description: 'Arguments to use in order to choose the backend DB'
243
244 - parameter:
245     name: 'bottlenecks-params-huawei-us-deploy-bare-1'
246     parameters:
247         - string:
248             name: BOTTLENECKS_DB_TARGET
249             default: '213.77.62.197'
250             description: 'Arguments to use in order to choose the backend DB'
251
252 - parameter:
253     name: 'bottlenecks-params-zte-build-1'
254     parameters:
255         - string:
256             name: BOTTLENECKS_DB_TARGET
257             default: '213.77.62.197'
258             description: 'Arguments to use in order to choose the backend DB'
259
260 - parameter:
261     name: 'bottlenecks-params-orange-pod2'
262     parameters:
263         - string:
264             name: BOTTLENECKS_DB_TARGET
265             default: '213.77.62.197'
266             description: 'Arguments to use in order to choose the backend DB'