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}'
97 name: '$BUILD_NUMBER Suite: $FUNCTEST_SUITE_NAME Scenario: $DEPLOY_SCENARIO'
103 - '{installer}-defaults'
104 - 'functest-{testsuite}-parameter'
106 name: DEPLOY_SCENARIO
107 default: 'os-odl_l2-nofeature-ha'
108 - functest-parameter:
109 gs-pathname: '{gs-pathname}'
113 credentials-id: '{ssh-credentials}'
118 - 'functest-{testsuite}-builder'
120 ########################
122 ########################
124 name: functest-daily-parameter
127 name: FUNCTEST_SUITE_NAME
129 description: "Suite name to run"
131 name: functest-suite-parameter
134 name: FUNCTEST_SUITE_NAME
146 name: functest-parameter
150 default: '{gs-pathname}'
151 description: "Version directory where the opnfv documents will be stored in gs repository"
153 name: FUNCTEST_REPO_DIR
154 default: "/home/opnfv/repos/functest"
155 description: "Directory where the Functest repository is cloned"
157 name: PUSH_RESULTS_TO_DB
159 description: "Push the results of all the tests to the resultDB"
163 description: "Show debug output information"
164 ########################
166 ########################
168 name: 'functest-master'
172 ########################
174 ########################
176 name: functest-daily-builder
181 - 'functest-store-results'
184 name: functest-suite-builder
190 if [ "${PUSH_RESULTS_TO_DB}" == "true" ]; then
193 echo "Functest: run $FUNCTEST_SUITE_NAME"
194 cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh --test $FUNCTEST_SUITE_NAME ${flag}"
195 container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
196 docker exec $container_id $cmd
205 if [ "${PUSH_RESULTS_TO_DB}" == "true" ]; then
208 echo "Functest: running all the tests"
209 cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh ${flag}"
210 container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
211 docker exec $container_id $cmd
214 name: set-functest-env
219 [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
220 # labconfig is used only for joid
222 if [[ ${INSTALLER_TYPE} == 'apex' ]]; then
223 instack_mac=$(sudo virsh domiflist instack | grep default | \
224 grep -Eo "[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+")
225 INSTALLER_IP=$(/usr/sbin/arp -e | grep ${instack_mac} | awk {'print $1'})
226 sshkey="-v /root/.ssh/id_rsa:/root/.ssh/id_rsa"
227 sudo iptables -D FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable
228 sudo iptables -D FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable
229 elif [[ ${INSTALLER_TYPE} == 'joid' ]]; then
230 # If production lab then creds may be retrieved dynamically
231 # creds are on the jumphost, always in the same folder
232 labconfig="-v $LAB_CONFIG/admin-openrc:/home/opnfv/functest/conf/openstack.creds"
233 # If dev lab, credentials may not be the default ones, just provide a path to put them into docker
234 # replace the default one by the customized one provided by jenkins config
236 echo "Functest: Start Docker and prepare environment"
237 envs="-e INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} \
238 -e NODE_NAME=${NODE_NAME} -e DEPLOY_SCENARIO=${DEPLOY_SCENARIO} \
239 -e CI_DEBUG=${CI_DEBUG}"
241 dir_result="${HOME}/opnfv/functest/reports"
242 mkdir -p ${dir_result}
243 sudo rm -rf ${dir_result}/*
244 res_volume="-v ${dir_result}:/home/opnfv/functest/results"
246 docker pull opnfv/functest:latest_stable >$redirect
247 cmd="sudo docker run --privileged=true -id ${envs} ${labconfig} ${sshkey} ${res_volume} opnfv/functest:latest_stable /bin/bash"
248 echo "Functest: Running docker run command: ${cmd}"
252 container_id=$(docker ps | grep 'opnfv/functest:latest_stable' | awk '{print $1}' | head -1)
253 echo "Container ID=${container_id}"
254 if [ -z ${container_id} ]; then
255 echo "Cannot find opnfv/functest container ID ${container_id}. Please check if it is existing."
259 echo "Starting the container: docker start ${container_id}"
260 docker start ${container_id}
263 if [ $(docker ps | grep 'opnfv/functest:latest_stable' | wc -l) == 0 ]; then
264 echo "The container opnfv/functest with ID=${container_id} has not been properly started. Exiting..."
267 cmd="${FUNCTEST_REPO_DIR}/docker/prepare_env.sh"
268 echo "Executing command inside the docker: ${cmd}"
269 docker exec ${container_id} ${cmd}
272 name: functest-store-results
275 !include-raw: res-build.sh
278 name: functest-cleanup
282 [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
284 echo "Cleaning up docker containers/images..."
285 # Remove previous running containers if exist
286 if [[ ! -z $(docker ps -a | grep opnfv/functest) ]]; then
287 echo "Removing existing opnfv/functest containers..."
288 docker ps -a | grep opnfv/functest | awk '{print $1}' | xargs docker rm -f >$redirect
291 # Remove existing images if exist
292 if [[ ! -z $(docker images | grep opnfv/functest) ]]; then
293 echo "Docker images to remove:"
294 docker images | head -1 && docker images | grep opnfv/functest
295 image_tags=($(docker images | grep opnfv/functest | awk '{print $2}'))
296 for tag in "${image_tags[@]}"; do
297 echo "Removing docker image opnfv/functest:$tag..."
298 docker rmi opnfv/functest:$tag >$redirect