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 #--------------------------------
86 #--------------------------------
93 - 'functest-{installer}-{pod}-{testsuite}-{stream}'
95 ################################
97 ################################
99 name: 'functest-{installer}-{pod}-{testsuite}-{stream}'
110 name: '$BUILD_NUMBER Suite: $FUNCTEST_SUITE_NAME Scenario: $DEPLOY_SCENARIO'
116 - '{installer}-defaults'
117 - 'functest-{testsuite}-parameter'
119 name: DEPLOY_SCENARIO
120 default: 'os-odl_l2-nofeature-ha'
121 - functest-parameter:
122 gs-pathname: '{gs-pathname}'
126 credentials-id: '{ssh-credentials}'
131 - 'functest-{testsuite}-builder'
133 ########################
135 ########################
137 name: functest-daily-parameter
140 name: FUNCTEST_SUITE_NAME
142 description: "Suite name to run"
144 name: functest-suite-parameter
147 name: FUNCTEST_SUITE_NAME
159 name: functest-parameter
163 default: '{gs-pathname}'
164 description: "Version directory where the opnfv documents will be stored in gs repository"
166 name: FUNCTEST_REPO_DIR
167 default: "/home/opnfv/repos/functest"
168 description: "Directory where the Functest repository is cloned"
170 name: PUSH_RESULTS_TO_DB
172 description: "Push the results of all the tests to the resultDB"
176 description: "Show debug output information"
177 ########################
179 ########################
181 name: 'functest-master'
185 ########################
187 ########################
189 name: functest-daily-builder
194 - 'functest-store-results'
197 name: functest-suite-builder
203 if [ "${PUSH_RESULTS_TO_DB}" == "true" ]; then
206 echo "Functest: run $FUNCTEST_SUITE_NAME"
207 cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh --test $FUNCTEST_SUITE_NAME ${flag}"
208 container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
209 docker exec $container_id $cmd
218 if [ "${PUSH_RESULTS_TO_DB}" == "true" ]; then
221 echo "Functest: running all the tests"
222 cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh ${flag}"
223 container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
224 docker exec $container_id $cmd
227 name: set-functest-env
232 [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
233 # labconfig is used only for joid
235 if [[ ${INSTALLER_TYPE} == 'apex' ]]; then
236 instack_mac=$(sudo virsh domiflist instack | grep default | \
237 grep -Eo "[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+")
238 INSTALLER_IP=$(/usr/sbin/arp -e | grep ${instack_mac} | awk {'print $1'})
239 sshkey="-v /root/.ssh/id_rsa:/root/.ssh/id_rsa"
240 sudo iptables -D FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable
241 sudo iptables -D FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable
242 elif [[ ${INSTALLER_TYPE} == 'joid' ]]; then
243 # If production lab then creds may be retrieved dynamically
244 # creds are on the jumphost, always in the same folder
245 labconfig="-v $LAB_CONFIG/admin-openrc:/home/opnfv/functest/conf/openstack.creds"
246 # If dev lab, credentials may not be the default ones, just provide a path to put them into docker
247 # replace the default one by the customized one provided by jenkins config
249 echo "Functest: Start Docker and prepare environment"
250 envs="-e INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} \
251 -e NODE_NAME=${NODE_NAME} -e DEPLOY_SCENARIO=${DEPLOY_SCENARIO} \
252 -e CI_DEBUG=${CI_DEBUG}"
254 dir_result="${HOME}/opnfv/functest/results/"
255 mkdir -p ${dir_result}
256 sudo rm -rf ${dir_result}/*
257 res_volume="-v ${dir_result}:/home/opnfv/functest/results"
259 docker pull opnfv/functest:latest >$redirect
260 cmd="sudo docker run --privileged=true -id ${envs} ${labconfig} ${sshkey} ${res_volume} opnfv/functest:latest /bin/bash"
261 echo "Functest: Running docker run command: ${cmd}"
265 container_id=$(docker ps | grep 'opnfv/functest:latest' | awk '{print $1}' | head -1)
266 echo "Container ID=${container_id}"
267 if [ -z ${container_id} ]; then
268 echo "Cannot find opnfv/functest container ID ${container_id}. Please check if it is existing."
272 echo "Starting the container: docker start ${container_id}"
273 docker start ${container_id}
276 if [ $(docker ps | grep 'opnfv/functest:latest' | wc -l) == 0 ]; then
277 echo "The container opnfv/functest with ID=${container_id} has not been properly started. Exiting..."
280 cmd="${FUNCTEST_REPO_DIR}/docker/prepare_env.sh"
281 echo "Executing command inside the docker: ${cmd}"
282 docker exec ${container_id} ${cmd}
285 name: functest-store-results
288 !include-raw: ../../utils/push-test-logs.sh
291 name: functest-cleanup
295 [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
297 echo "Cleaning up docker containers/images..."
298 # Remove previous running containers if exist
299 if [[ ! -z $(docker ps -a | grep opnfv/functest) ]]; then
300 echo "Removing existing opnfv/functest containers..."
301 docker ps -a | grep opnfv/functest | awk '{print $1}' | xargs docker rm -f >$redirect
304 # Remove existing images if exist
305 if [[ ! -z $(docker images | grep opnfv/functest) ]]; then
306 echo "Docker images to remove:"
307 docker images | head -1 && docker images | grep opnfv/functest
308 image_tags=($(docker images | grep opnfv/functest | awk '{print $2}'))
309 for tag in "${image_tags[@]}"; do
310 echo "Removing docker image opnfv/functest:$tag..."
311 docker rmi opnfv/functest:$tag >$redirect