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 #--------------------------------
34 #--------------------------------
35 - huawei-us-deploy-bare-1:
41 - intel-us-deploy-virtual-2:
56 #--------------------------------
63 - 'functest-{installer}-{pod}-{testsuite}-{stream}'
65 ################################
67 ################################
69 name: 'functest-{installer}-{pod}-{testsuite}-{stream}'
73 name: '$BUILD_NUMBER Suite: $FUNCTEST_SUITE_NAME SDN: $SDN_CONTROLLER Scenario: $DEPLOY_SCENARIO'
79 - '{installer}-defaults'
80 - 'functest-{testsuite}-parameter'
82 gs-pathname: '{gs-pathname}'
86 credentials-id: '{ssh-credentials}'
91 - 'functest-{testsuite}-builder'
93 ########################
95 ########################
97 name: functest-daily-parameter
100 name: FUNCTEST_SUITE_NAME
102 description: "Suite name to run"
104 name: functest-suite-parameter
107 name: FUNCTEST_SUITE_NAME
115 name: functest-parameter
119 default: '{gs-pathname}'
120 description: "Version directory where the opnfv documents will be stored in gs repository"
122 name: FUNCTEST_REPO_DIR
123 default: "/home/opnfv/repos/functest"
124 description: "Directory where the Functest repository is cloned"
126 name: PUSH_RESULTS_TO_DB
128 description: "Push the results of all the tests to the resultDB"
129 ########################
131 ########################
133 name: 'functest-master'
135 - pollscm: "H 9 * * *"
136 ########################
138 ########################
140 name: functest-daily-builder
145 - 'functest-store-results'
148 name: functest-suite-builder
154 if [ "${PUSH_RESULTS_TO_DB}" == "true" ]; then
157 echo "Functest: run $FUNCTEST_SUITE_NAME"
158 cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh --test $FUNCTEST_SUITE_NAME ${flag}"
159 container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
160 docker exec $container_id $cmd
169 if [ "${PUSH_RESULTS_TO_DB}" == "true" ]; then
172 echo "Functest: running all the tests"
173 cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh ${flag}"
174 container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
175 docker exec $container_id $cmd
178 name: set-functest-env
183 # labconfig is used only for joid
185 if [[ ${INSTALLER_TYPE} == 'apex' ]]; then
186 INSTALLER_IP=$(grep instack /var/lib/libvirt/dnsmasq/default.leases \
187 |awk '{print $3}' | head -n 1)
188 sshkey="-v /root/.ssh/id_rsa:/root/.ssh/id_rsa"
189 sudo iptables -D FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable
190 sudo iptables -D FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable
191 elif [[ ${INSTALLER_TYPE} == 'joid' ]]; then
192 # If production lab then creds may be retrieved dynamically
193 # creds are on the jumphost, always in the same folder
194 labconfig="-v $HOME/joid_config/admin-openrc:/home/opnfv/functest/conf/openstack.creds"
195 # If dev lab, credentials may not be the default ones, just provide a path to put them into docker
196 # replace the default one by the customized one provided by jenkins config
197 if [ -n "${LAB_CONFIG}" ]; then
198 labconfig="-v ${LAB_CONFIG}:/home/opnfv/functest/conf/openstack.creds"
201 echo "Functest: Start Docker and prepare environment"
202 envs="INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} -e NODE_NAME=${NODE_NAME}"
204 dir_result="${HOME}/opnfv/functest/reports"
205 mkdir -p ${dir_result}
206 rm -rf ${dir_result}/*
207 $res_volume="-v ${dir_result}:/home/opnfv/functest/results"
209 docker pull opnfv/functest:latest_stable
210 cmd="docker run -id -e $envs ${labconfig} ${sshkey} ${res_volume} opnfv/functest:latest_stable /bin/bash"
211 echo "Functest: Running docker run command: ${cmd}"
215 container_id=$(docker ps | grep 'opnfv/functest:latest_stable' | awk '{print $1}' | head -1)
216 echo "Container ID=${container_id}"
217 if [ -z ${container_id} ]; then
218 echo "Cannot find opnfv/functest container ID ${container_id}. Please check if it is existing."
222 echo "Starting the container: docker start ${container_id}"
223 docker start ${container_id}
226 if [ $(docker ps | grep 'opnfv/functest:latest_stable' | wc -l) == 0 ]; then
227 echo "The container opnfv/functest with ID=${container_id} has not been properly started. Exiting..."
230 cmd="${FUNCTEST_REPO_DIR}/docker/prepare_env.sh"
231 echo "Executing command inside the docker: ${cmd}"
232 docker exec ${container_id} ${cmd}
235 name: functest-store-results
238 !include-raw res-build.sh
241 name: functest-cleanup
246 echo "Cleaning up docker containers/images..."
248 # Remove previous running containers if exist
249 if [[ ! -z $(docker ps -a | grep opnfv/functest) ]]; then
250 echo "Removing existing opnfv/functest containers..."
251 docker ps | grep opnfv/functest | awk '{print $1}' | xargs docker stop
252 docker ps -a | grep opnfv/functest | awk '{print $1}' | xargs docker rm
255 # Remove existing images if exist
256 if [[ ! -z $(docker images | grep opnfv/functest) ]]; then
257 echo "Docker images to remove:"
258 docker images | head -1 && docker images | grep opnfv/functest
259 image_tags=($(docker images | grep opnfv/functest | awk '{print $2}'))
260 for tag in "${image_tags[@]}"; do
261 echo "Removing docker image opnfv/functest:$tag..."
262 docker rmi opnfv/functest:$tag