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:
44 #--------------------------------
46 #--------------------------------
74 #--------------------------------
81 - 'functest-{installer}-{pod}-{testsuite}-{stream}'
83 ################################
85 ################################
87 name: 'functest-{installer}-{pod}-{testsuite}-{stream}'
91 name: '$BUILD_NUMBER Suite: $FUNCTEST_SUITE_NAME Scenario: $DEPLOY_SCENARIO'
97 - '{installer}-defaults'
98 - 'functest-{testsuite}-parameter'
100 name: DEPLOY_SCENARIO
101 default: 'os-odl_l2-nofeature-ha'
102 - functest-parameter:
103 gs-pathname: '{gs-pathname}'
107 credentials-id: '{ssh-credentials}'
112 - 'functest-{testsuite}-builder'
114 ########################
116 ########################
118 name: functest-daily-parameter
121 name: FUNCTEST_SUITE_NAME
123 description: "Suite name to run"
125 name: functest-suite-parameter
128 name: FUNCTEST_SUITE_NAME
140 name: functest-parameter
144 default: '{gs-pathname}'
145 description: "Version directory where the opnfv documents will be stored in gs repository"
147 name: FUNCTEST_REPO_DIR
148 default: "/home/opnfv/repos/functest"
149 description: "Directory where the Functest repository is cloned"
151 name: PUSH_RESULTS_TO_DB
153 description: "Push the results of all the tests to the resultDB"
157 description: "Show debug output information"
158 ########################
160 ########################
162 name: 'functest-master'
166 ########################
168 ########################
170 name: functest-daily-builder
175 - 'functest-store-results'
178 name: functest-suite-builder
184 if [ "${PUSH_RESULTS_TO_DB}" == "true" ]; then
187 echo "Functest: run $FUNCTEST_SUITE_NAME"
188 cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh --test $FUNCTEST_SUITE_NAME ${flag}"
189 container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
190 docker exec $container_id $cmd
199 if [ "${PUSH_RESULTS_TO_DB}" == "true" ]; then
202 echo "Functest: running all the tests"
203 cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh ${flag}"
204 container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
205 docker exec $container_id $cmd
208 name: set-functest-env
213 [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
214 # labconfig is used only for joid
216 if [[ ${INSTALLER_TYPE} == 'apex' ]]; then
217 instack_mac=$(sudo virsh domiflist instack | grep default | \
218 grep -Eo "[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+")
219 INSTALLER_IP=$(/usr/sbin/arp -e | grep ${instack_mac} | awk {'print $1'})
220 sshkey="-v /root/.ssh/id_rsa:/root/.ssh/id_rsa"
221 sudo iptables -D FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable
222 sudo iptables -D FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable
223 elif [[ ${INSTALLER_TYPE} == 'joid' ]]; then
224 # If production lab then creds may be retrieved dynamically
225 # creds are on the jumphost, always in the same folder
226 labconfig="-v $LAB_CONFIG/admin-openrc:/home/opnfv/functest/conf/openstack.creds"
227 # If dev lab, credentials may not be the default ones, just provide a path to put them into docker
228 # replace the default one by the customized one provided by jenkins config
230 echo "Functest: Start Docker and prepare environment"
231 envs="-e INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} \
232 -e NODE_NAME=${NODE_NAME} -e DEPLOY_SCENARIO=${DEPLOY_SCENARIO} \
233 -e CI_DEBUG=${CI_DEBUG}"
235 dir_result="${HOME}/opnfv/functest/reports"
236 mkdir -p ${dir_result}
237 sudo rm -rf ${dir_result}/*
238 res_volume="-v ${dir_result}:/home/opnfv/functest/results"
240 docker pull opnfv/functest:latest_stable >$redirect
241 cmd="sudo docker run --privileged=true -id ${envs} ${labconfig} ${sshkey} ${res_volume} opnfv/functest:latest_stable /bin/bash"
242 echo "Functest: Running docker run command: ${cmd}"
246 container_id=$(docker ps | grep 'opnfv/functest:latest_stable' | awk '{print $1}' | head -1)
247 echo "Container ID=${container_id}"
248 if [ -z ${container_id} ]; then
249 echo "Cannot find opnfv/functest container ID ${container_id}. Please check if it is existing."
253 echo "Starting the container: docker start ${container_id}"
254 docker start ${container_id}
257 if [ $(docker ps | grep 'opnfv/functest:latest_stable' | wc -l) == 0 ]; then
258 echo "The container opnfv/functest with ID=${container_id} has not been properly started. Exiting..."
261 cmd="${FUNCTEST_REPO_DIR}/docker/prepare_env.sh"
262 echo "Executing command inside the docker: ${cmd}"
263 docker exec ${container_id} ${cmd}
266 name: functest-store-results
269 !include-raw: res-build.sh
272 name: functest-cleanup
276 [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
278 echo "Cleaning up docker containers/images..."
279 # Remove previous running containers if exist
280 if [[ ! -z $(docker ps -a | grep opnfv/functest) ]]; then
281 echo "Removing existing opnfv/functest containers..."
282 docker ps -a | grep opnfv/functest | awk '{print $1}' | xargs docker rm -f >$redirect
285 # Remove existing images if exist
286 if [[ ! -z $(docker images | grep opnfv/functest) ]]; then
287 echo "Docker images to remove:"
288 docker images | head -1 && docker images | grep opnfv/functest
289 image_tags=($(docker images | grep opnfv/functest | awk '{print $2}'))
290 for tag in "${image_tags[@]}"; do
291 echo "Removing docker image opnfv/functest:$tag..."
292 docker rmi opnfv/functest:$tag >$redirect