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 #--------------------------------
25 # everything runs against master branch
26 #--------------------------------
28 - huawei-us-deploy-bare-1:
34 - intel-us-deploy-virtual-2:
46 #--------------------------------
49 #--------------------------------
51 #--------------------------------
52 # - huawei-us-deploy-bare-1:
64 #--------------------------------
66 #--------------------------------
70 # - intelpod2-jumphost:
85 #--------------------------------
92 - 'functest-{installer}-{pod}-{testsuite}-{stream}'
94 ################################
96 ################################
98 name: 'functest-{installer}-{pod}-{testsuite}-{stream}'
102 name: '$BUILD_NUMBER Suite: $FUNCTEST_SUITE_NAME SDN: $SDN_CONTROLLER Feature: $OPNFV_FEATURE'
108 - '{installer}-defaults'
109 - 'functest-{testsuite}-parameter'
110 - functest-parameter:
111 gs-pathname: '{gs-pathname}'
115 credentials-id: '{ssh-credentials}'
120 - 'functest-{testsuite}-builder'
122 ########################
124 ########################
126 name: functest-daily-parameter
129 name: FUNCTEST_SUITE_NAME
131 description: "Suite name to run"
133 name: functest-suite-parameter
136 name: FUNCTEST_SUITE_NAME
144 name: functest-parameter
148 default: '{gs-pathname}'
149 description: "Version directory where the opnfv documents will be stored in gs repository"
151 name: FUNCTEST_REPO_DIR
152 default: "/home/opnfv/repos/functest"
153 description: "Directory where the Functest repository is cloned"
155 name: PUSH_RESULTS_TO_DB
157 description: "Push the results of all the tests to the resultDB"
158 ########################
160 ########################
162 name: 'functest-master'
164 - pollscm: "H 9 * * *"
165 ########################
167 ########################
169 name: functest-daily-builder
174 - 'functest-store-results'
177 name: functest-suite-builder
183 if [ "${PUSH_RESULTS_TO_DB}" == "true" ]; then
186 echo "Functest: run $FUNCTEST_SUITE_NAME"
187 cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh --test $FUNCTEST_SUITE_NAME ${flag}"
188 container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
189 docker exec $container_id $cmd
198 if [ "${PUSH_RESULTS_TO_DB}" == "true" ]; then
201 echo "Functest: running all the tests"
202 cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh ${flag}"
203 container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
204 docker exec $container_id $cmd
207 name: set-functest-env
212 # labconfig is used only for joid
214 if [[ ${INSTALLER_TYPE} == 'apex' ]]; then
215 INSTALLER_IP=$(grep instack /var/lib/libvirt/dnsmasq/default.leases \
216 |awk '{print $3}' | head -n 1)
217 sshkey="-v /root/.ssh/id_rsa:/root/.ssh/id_rsa"
218 sudo iptables -D FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable
219 sudo iptables -D FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable
220 elif [[ ${INSTALLER_TYPE} == 'joid' ]]; then
221 # If production lab then creds may be retrieved dynamically
222 # creds are on the jumphost, always in the same folder
223 labconfig="-v /var/lib/jenkins/joid_config/admin-openrc:/home/opnfv/functest/conf/openstack.creds"
224 # If dev lab, credentials may not be the default ones, just provide a path to put them into docker
225 # replace the default one by the customized one provided by jenkins config
226 if [ -n "${LAB_CONFIG}" ]; then
227 labconfig="-v ${LAB_CONFIG}:/home/opnfv/functest/conf/openstack.creds"
230 echo "Functest: Start Docker and prepare environment"
231 envs="INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} -e NODE_NAME=${NODE_NAME}"
233 dir_result="${HOME}/opnfv/functest/reports"
234 mkdir -f ${dir_result}
235 rm -rf ${dir_result}/*
236 $res_volume="-v ${dir_result}:/home/opnfv/functest/results"
238 docker pull opnfv/functest:latest_stable
239 cmd="docker run -id -e $envs ${labconfig} ${sshkey} ${res_volume} opnfv/functest:latest_stable /bin/bash"
240 echo "Functest: Running docker run command: ${cmd}"
244 container_id=$(docker ps | grep 'opnfv/functest:latest_stable' | awk '{print $1}' | head -1)
245 echo "Container ID=${container_id}"
246 if [ -z ${container_id} ]; then
247 echo "Cannot find opnfv/functest container ID ${container_id}. Please check if it is existing."
251 echo "Starting the container: docker start ${container_id}"
252 docker start ${container_id}
255 if [ $(docker ps | grep 'opnfv/functest:latest_stable' | wc -l) == 0 ]; then
256 echo "The container opnfv/functest with ID=${container_id} has not been properly started. Exiting..."
259 cmd="${FUNCTEST_REPO_DIR}/docker/prepare_env.sh"
260 echo "Executing command inside the docker: ${cmd}"
261 docker exec ${container_id} ${cmd}
264 name: functest-store-results
267 !include-raw res-build.sh
270 name: functest-cleanup
275 echo "Cleaning up docker containers/images..."
277 # Remove previous running containers if exist
278 if [[ ! -z $(docker ps -a | grep opnfv/functest) ]]; then
279 echo "Removing existing opnfv/functest containers..."
280 docker ps | grep opnfv/functest | awk '{print $1}' | xargs docker stop
281 docker ps -a | grep opnfv/functest | awk '{print $1}' | xargs docker rm
284 # Remove existing images if exist
285 if [[ ! -z $(docker images | grep opnfv/functest) ]]; then
286 echo "Docker images to remove:"
287 docker images | head -1 && docker images | grep opnfv/functest
288 image_tags=($(docker images | grep opnfv/functest | awk '{print $2}'))
289 for tag in "${image_tags[@]}"; do
290 echo "Removing docker image opnfv/functest:$tag..."
291 docker rmi opnfv/functest:$tag