1 ###################################
2 # job configuration for functest
3 ###################################
9 #--------------------------------
11 #--------------------------------
16 brahmaputra: &brahmaputra
18 branch: 'stable/{stream}'
19 gs-pathname: '/{stream}'
20 #--------------------------------
21 # POD, INSTALLER, AND BRANCH MAPPING
22 #--------------------------------
24 #--------------------------------
35 - huawei-us-deploy-bare-1:
53 #--------------------------------
55 #--------------------------------
89 #--------------------------------
96 - 'functest-{installer}-{pod}-{testsuite}-{stream}'
98 ################################
100 ################################
102 name: 'functest-{installer}-{pod}-{testsuite}-{stream}'
113 name: '$BUILD_NUMBER Suite: $FUNCTEST_SUITE_NAME Scenario: $DEPLOY_SCENARIO'
122 - '{installer}-defaults'
123 - 'functest-{testsuite}-parameter'
125 name: DEPLOY_SCENARIO
126 default: 'os-odl_l2-nofeature-ha'
127 - functest-parameter:
128 gs-pathname: '{gs-pathname}'
132 credentials-id: '{ssh-credentials}'
137 - 'functest-{testsuite}-builder'
139 ########################
141 ########################
143 name: functest-daily-parameter
146 name: FUNCTEST_SUITE_NAME
148 description: "Suite name to run"
150 name: functest-suite-parameter
153 name: FUNCTEST_SUITE_NAME
165 name: functest-parameter
169 default: '{gs-pathname}'
170 description: "Version directory where the opnfv documents will be stored in gs repository"
172 name: FUNCTEST_REPO_DIR
173 default: "/home/opnfv/repos/functest"
174 description: "Directory where the Functest repository is cloned"
176 name: PUSH_RESULTS_TO_DB
178 description: "Push the results of all the tests to the resultDB"
182 description: "Show debug output information"
183 ########################
185 ########################
187 name: 'functest-master'
191 ########################
193 ########################
195 name: functest-daily-builder
200 - 'functest-store-results'
203 name: functest-suite-builder
209 if [ "${PUSH_RESULTS_TO_DB}" == "true" ]; then
212 echo "Functest: run $FUNCTEST_SUITE_NAME"
213 cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh --test $FUNCTEST_SUITE_NAME ${flag}"
214 container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
215 docker exec $container_id $cmd
224 if [ "${PUSH_RESULTS_TO_DB}" == "true" ]; then
227 cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh ${flag}"
228 container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
229 docker exec $container_id $cmd
232 name: set-functest-env
237 [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
238 # labconfig is used only for joid
240 if [[ ${INSTALLER_TYPE} == 'apex' ]]; then
241 instack_mac=$(sudo virsh domiflist instack | grep default | \
242 grep -Eo "[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+")
243 INSTALLER_IP=$(/usr/sbin/arp -e | grep ${instack_mac} | awk {'print $1'})
244 sshkey="-v /root/.ssh/id_rsa:/root/.ssh/id_rsa"
245 sudo iptables -D FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable
246 sudo iptables -D FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable
247 elif [[ ${INSTALLER_TYPE} == 'joid' ]]; then
248 # If production lab then creds may be retrieved dynamically
249 # creds are on the jumphost, always in the same folder
250 labconfig="-v $LAB_CONFIG/admin-openrc:/home/opnfv/functest/conf/openstack.creds"
251 # If dev lab, credentials may not be the default ones, just provide a path to put them into docker
252 # replace the default one by the customized one provided by jenkins config
254 echo "Functest: Start Docker and prepare environment"
255 envs="-e INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} \
256 -e NODE_NAME=${NODE_NAME} -e DEPLOY_SCENARIO=${DEPLOY_SCENARIO} \
257 -e CI_DEBUG=${CI_DEBUG}"
258 branch=${GIT_BRANCH##*/}
259 dir_result="${HOME}/opnfv/functest/results/${branch}"
260 mkdir -p ${dir_result}
261 sudo rm -rf ${dir_result}/*
262 res_volume="-v ${dir_result}:/home/opnfv/functest/results"
264 docker pull opnfv/functest:latest >$redirect
265 cmd="sudo docker run --privileged=true -id ${envs} ${labconfig} ${sshkey} ${res_volume} opnfv/functest:latest /bin/bash"
266 echo "Functest: Running docker run command: ${cmd}"
270 container_id=$(docker ps | grep 'opnfv/functest:latest' | awk '{print $1}' | head -1)
271 echo "Container ID=${container_id}"
272 if [ -z ${container_id} ]; then
273 echo "Cannot find opnfv/functest container ID ${container_id}. Please check if it is existing."
277 echo "Starting the container: docker start ${container_id}"
278 docker start ${container_id}
281 if [ $(docker ps | grep 'opnfv/functest:latest' | wc -l) == 0 ]; then
282 echo "The container opnfv/functest with ID=${container_id} has not been properly started. Exiting..."
285 cmd="${FUNCTEST_REPO_DIR}/docker/prepare_env.sh"
286 echo "Executing command inside the docker: ${cmd}"
287 docker exec ${container_id} ${cmd}
290 name: functest-store-results
293 !include-raw: ../../utils/push-test-logs.sh
296 name: functest-cleanup
300 [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
302 echo "Cleaning up docker containers/images..."
303 # Remove previous running containers if exist
304 if [[ ! -z $(docker ps -a | grep opnfv/functest) ]]; then
305 echo "Removing existing opnfv/functest containers..."
306 docker ps -a | grep opnfv/functest | awk '{print $1}' | xargs docker rm -f >$redirect
309 # Remove existing images if exist
310 if [[ ! -z $(docker images | grep opnfv/functest) ]]; then
311 echo "Docker images to remove:"
312 docker images | head -1 && docker images | grep opnfv/functest
313 image_tags=($(docker images | grep opnfv/functest | awk '{print $2}'))
314 for tag in "${image_tags[@]}"; do
315 echo "Removing docker image opnfv/functest:$tag..."
316 docker rmi opnfv/functest:$tag >$redirect