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 #--------------------------------
32 - huawei-us-deploy-bare-1:
47 #--------------------------------
49 #--------------------------------
80 #--------------------------------
87 - 'functest-{installer}-{pod}-{testsuite}-{stream}'
89 ################################
91 ################################
93 name: 'functest-{installer}-{pod}-{testsuite}-{stream}'
104 name: '$BUILD_NUMBER Suite: $FUNCTEST_SUITE_NAME Scenario: $DEPLOY_SCENARIO'
110 - '{installer}-defaults'
111 - 'functest-{testsuite}-parameter'
113 name: DEPLOY_SCENARIO
114 default: 'os-odl_l2-nofeature-ha'
115 - functest-parameter:
116 gs-pathname: '{gs-pathname}'
120 credentials-id: '{ssh-credentials}'
125 - 'functest-{testsuite}-builder'
127 ########################
129 ########################
131 name: functest-daily-parameter
134 name: FUNCTEST_SUITE_NAME
136 description: "Suite name to run"
138 name: functest-suite-parameter
141 name: FUNCTEST_SUITE_NAME
153 name: functest-parameter
157 default: '{gs-pathname}'
158 description: "Version directory where the opnfv documents will be stored in gs repository"
160 name: FUNCTEST_REPO_DIR
161 default: "/home/opnfv/repos/functest"
162 description: "Directory where the Functest repository is cloned"
164 name: PUSH_RESULTS_TO_DB
166 description: "Push the results of all the tests to the resultDB"
170 description: "Show debug output information"
171 ########################
173 ########################
175 name: 'functest-master'
179 ########################
181 ########################
183 name: functest-daily-builder
188 - 'functest-store-results'
191 name: functest-suite-builder
197 if [ "${PUSH_RESULTS_TO_DB}" == "true" ]; then
200 echo "Functest: run $FUNCTEST_SUITE_NAME"
201 cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh --test $FUNCTEST_SUITE_NAME ${flag}"
202 container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
203 docker exec $container_id $cmd
212 if [ "${PUSH_RESULTS_TO_DB}" == "true" ]; then
215 echo "Functest: running all the tests"
216 cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh ${flag}"
217 container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
218 docker exec $container_id $cmd
221 name: set-functest-env
226 [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
227 # labconfig is used only for joid
229 if [[ ${INSTALLER_TYPE} == 'apex' ]]; then
230 instack_mac=$(sudo virsh domiflist instack | grep default | \
231 grep -Eo "[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+")
232 INSTALLER_IP=$(/usr/sbin/arp -e | grep ${instack_mac} | awk {'print $1'})
233 sshkey="-v /root/.ssh/id_rsa:/root/.ssh/id_rsa"
234 sudo iptables -D FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable
235 sudo iptables -D FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable
236 elif [[ ${INSTALLER_TYPE} == 'joid' ]]; then
237 # If production lab then creds may be retrieved dynamically
238 # creds are on the jumphost, always in the same folder
239 labconfig="-v $LAB_CONFIG/admin-openrc:/home/opnfv/functest/conf/openstack.creds"
240 # If dev lab, credentials may not be the default ones, just provide a path to put them into docker
241 # replace the default one by the customized one provided by jenkins config
243 echo "Functest: Start Docker and prepare environment"
244 envs="-e INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} \
245 -e NODE_NAME=${NODE_NAME} -e DEPLOY_SCENARIO=${DEPLOY_SCENARIO} \
246 -e CI_DEBUG=${CI_DEBUG}"
248 dir_result="${HOME}/opnfv/functest/reports"
249 mkdir -p ${dir_result}
250 sudo rm -rf ${dir_result}/*
251 res_volume="-v ${dir_result}:/home/opnfv/functest/results"
253 docker pull opnfv/functest:latest >$redirect
254 cmd="sudo docker run --privileged=true -id ${envs} ${labconfig} ${sshkey} ${res_volume} opnfv/functest:latest /bin/bash"
255 echo "Functest: Running docker run command: ${cmd}"
259 container_id=$(docker ps | grep 'opnfv/functest:latest' | awk '{print $1}' | head -1)
260 echo "Container ID=${container_id}"
261 if [ -z ${container_id} ]; then
262 echo "Cannot find opnfv/functest container ID ${container_id}. Please check if it is existing."
266 echo "Starting the container: docker start ${container_id}"
267 docker start ${container_id}
270 if [ $(docker ps | grep 'opnfv/functest:latest' | wc -l) == 0 ]; then
271 echo "The container opnfv/functest with ID=${container_id} has not been properly started. Exiting..."
274 cmd="${FUNCTEST_REPO_DIR}/docker/prepare_env.sh"
275 echo "Executing command inside the docker: ${cmd}"
276 docker exec ${container_id} ${cmd}
279 name: functest-store-results
282 !include-raw: res-build.sh
285 name: functest-cleanup
289 [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
291 echo "Cleaning up docker containers/images..."
292 # Remove previous running containers if exist
293 if [[ ! -z $(docker ps -a | grep opnfv/functest) ]]; then
294 echo "Removing existing opnfv/functest containers..."
295 docker ps -a | grep opnfv/functest | awk '{print $1}' | xargs docker rm -f >$redirect
298 # Remove existing images if exist
299 if [[ ! -z $(docker images | grep opnfv/functest) ]]; then
300 echo "Docker images to remove:"
301 docker images | head -1 && docker images | grep opnfv/functest
302 image_tags=($(docker images | grep opnfv/functest | awk '{print $2}'))
303 for tag in "${image_tags[@]}"; do
304 echo "Removing docker image opnfv/functest:$tag..."
305 docker rmi opnfv/functest:$tag >$redirect