1 ###################################
2 # job configuration for functest
3 ###################################
9 #--------------------------------
11 #--------------------------------
17 brahmaputra: &brahmaputra
19 branch: 'stable/{stream}'
20 gs-pathname: '/{stream}'
22 #--------------------------------
23 # POD, INSTALLER, AND BRANCH MAPPING
24 #--------------------------------
26 #--------------------------------
37 - huawei-us-deploy-bare-1:
58 #--------------------------------
60 #--------------------------------
91 - huawei-us-deploy-bare-2:
97 #--------------------------------
104 - 'functest-{installer}-{pod}-{testsuite}-{stream}'
106 ################################
108 ################################
110 name: 'functest-{installer}-{pod}-{testsuite}-{stream}'
121 name: '$BUILD_NUMBER Suite: $FUNCTEST_SUITE_NAME Scenario: $DEPLOY_SCENARIO'
130 - '{installer}-defaults'
131 - 'functest-{testsuite}-parameter'
133 name: DEPLOY_SCENARIO
134 default: 'os-odl_l2-nofeature-ha'
137 default: '{docker-tag}'
138 description: 'Tag to pull docker image'
139 - functest-parameter:
140 gs-pathname: '{gs-pathname}'
144 credentials-id: '{ssh-credentials}'
151 - 'functest-{testsuite}-builder'
153 ########################
155 ########################
157 name: functest-daily-parameter
160 name: FUNCTEST_SUITE_NAME
162 description: "Suite name to run"
164 name: functest-suite-parameter
167 name: FUNCTEST_SUITE_NAME
180 name: functest-parameter
184 default: '{gs-pathname}'
185 description: "Version directory where the opnfv documents will be stored in gs repository"
187 name: FUNCTEST_REPO_DIR
188 default: "/home/opnfv/repos/functest"
189 description: "Directory where the Functest repository is cloned"
191 name: PUSH_RESULTS_TO_DB
193 description: "Push the results of all the tests to the resultDB"
197 description: "Show debug output information"
198 ########################
200 ########################
202 name: 'functest-master'
206 ########################
208 ########################
210 name: functest-daily-builder
215 - 'functest-store-results'
218 name: functest-suite-builder
224 [[ "$PUSH_RESULTS_TO_DB" == "true" ]] && flags+=" -r"
225 echo "Functest: run $FUNCTEST_SUITE_NAME"
226 cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh --test $FUNCTEST_SUITE_NAME ${flags}"
227 container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
228 docker exec $container_id $cmd
237 [[ "$PUSH_RESULTS_TO_DB" == "true" ]] && flags+=" -r"
238 cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh ${flags}"
239 container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
240 docker exec $container_id $cmd
243 name: set-functest-env
248 [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
249 # labconfig is used only for joid
251 if [[ ${INSTALLER_TYPE} == 'apex' ]]; then
252 if virsh list | grep instack; then
253 instack_mac=$(sudo virsh domiflist instack | grep default | \
254 grep -Eo "[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+")
255 elif virsh list | grep undercloud; then
256 instack_mac=$(sudo virsh domiflist undercloud | grep default | \
257 grep -Eo "[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+")
259 echo "No available installer VM exists...exiting"
262 INSTALLER_IP=$(/usr/sbin/arp -e | grep ${instack_mac} | awk {'print $1'})
263 sshkey="-v /root/.ssh/id_rsa:/root/.ssh/id_rsa"
264 sudo iptables -D FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable
265 sudo iptables -D FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable
266 elif [[ ${INSTALLER_TYPE} == 'joid' ]]; then
267 # If production lab then creds may be retrieved dynamically
268 # creds are on the jumphost, always in the same folder
269 labconfig="-v $LAB_CONFIG/admin-openrc:/home/opnfv/functest/conf/openstack.creds"
270 # If dev lab, credentials may not be the default ones, just provide a path to put them into docker
271 # replace the default one by the customized one provided by jenkins config
273 echo "Functest: Start Docker and prepare environment"
274 envs="-e INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} \
275 -e NODE_NAME=${NODE_NAME} -e DEPLOY_SCENARIO=${DEPLOY_SCENARIO} \
276 -e BUILD_TAG=${BUILD_TAG} -e CI_DEBUG=${CI_DEBUG}"
277 branch=${GIT_BRANCH##*/}
278 dir_result="${HOME}/opnfv/functest/results/${branch}"
279 mkdir -p ${dir_result}
280 sudo rm -rf ${dir_result}/*
281 res_volume="-v ${dir_result}:/home/opnfv/functest/results"
283 echo "Functest: Pulling image opnfv/functest:${DOCKER_TAG}"
284 docker pull opnfv/functest:$DOCKER_TAG >${redirect}
286 cmd="sudo docker run --privileged=true -id ${envs} ${labconfig} ${sshkey} ${res_volume} opnfv/functest:${DOCKER_TAG} /bin/bash"
287 echo "Functest: Running docker run command: ${cmd}"
291 container_id=$(docker ps | grep "opnfv/functest:${DOCKER_TAG}" | awk '{print $1}' | head -1)
292 echo "Container ID=${container_id}"
293 if [ -z ${container_id} ]; then
294 echo "Cannot find opnfv/functest container ID ${container_id}. Please check if it is existing."
298 echo "Starting the container: docker start ${container_id}"
299 docker start ${container_id}
302 if [ $(docker ps | grep "opnfv/functest:${DOCKER_TAG}" | wc -l) == 0 ]; then
303 echo "The container opnfv/functest with ID=${container_id} has not been properly started. Exiting..."
306 cmd="${FUNCTEST_REPO_DIR}/docker/prepare_env.sh"
307 echo "Executing command inside the docker: ${cmd}"
308 docker exec ${container_id} ${cmd}
311 name: functest-store-results
314 !include-raw: ../../utils/push-test-logs.sh
317 name: functest-cleanup
321 [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
323 echo "Cleaning up docker containers/images..."
324 # Remove previous running containers if exist
325 if [[ ! -z $(docker ps -a | grep opnfv/functest) ]]; then
326 echo "Removing existing opnfv/functest containers..."
327 docker ps -a | grep opnfv/functest | awk '{print $1}' | xargs docker rm -f >${redirect}
330 # Remove existing images if exist
331 if [[ ! -z $(docker images | grep opnfv/functest) ]]; then
332 echo "Docker images to remove:"
333 docker images | head -1 && docker images | grep opnfv/functest
334 image_tags=($(docker images | grep opnfv/functest | awk '{print $2}'))
335 for tag in "${image_tags[@]}"; do
336 echo "Removing docker image opnfv/functest:$tag..."
337 docker rmi opnfv/functest:$tag >${redirect}