1 ###################################
2 # job configuration for functest
3 ###################################
18 - huawei-us-deploy-bare-1:
19 installer: compass4nfv
28 - 'functest-{installer}-{pod}-{testsuite}-{stream}'
29 - 'functest-verify-{stream}'
36 # branch: 'stable/brahmaputra'
37 # gs-pathname: '/brahmaputra'
39 ################################
41 ################################
43 name: 'functest-{installer}-{pod}-{testsuite}-{stream}'
47 name: '$BUILD_NUMBER: $FUNCTEST_SUITE_NAME'
53 - '{installer}-defaults'
54 - 'functest-{testsuite}-parameter'
59 credentials-id: '{ssh-credentials}'
64 - 'functest-{testsuite}-builder'
67 name: 'functest-verify-{stream}'
76 credentials-id: '{ssh-credentials}'
77 refspec: '$GERRIT_REFSPEC'
78 choosing-strategy: 'gerrit'
83 - patchset-created-event:
84 exclude-drafts: 'false'
85 exclude-trivial-rebase: 'false'
86 exclude-no-code-change: 'false'
87 - draft-published-event
88 - comment-added-contains-event:
89 comment-contains-value: 'recheck'
90 - comment-added-contains-event:
91 comment-contains-value: 'reverify'
93 - project-compare-type: 'ANT'
94 project-pattern: 'functest'
96 - branch-compare-type: 'ANT'
97 branch-pattern: '**/{branch}'
101 echo "Nothing to verify!"
103 ########################
105 ########################
107 name: functest-daily-parameter
110 name: FUNCTEST_SUITE_NAME
112 description: "Suite name to run"
114 name: functest-suite-parameter
117 name: FUNCTEST_SUITE_NAME
125 name: functest-parameter
129 default: '{gs-pathname}'
130 description: "Version directory where the opnfv documents will be stored in gs repository"
132 name: FUNCTEST_REPO_DIR
133 default: "/home/opnfv/repos/functest"
134 description: "Directory where the Functest repository is cloned"
136 name: PUSH_RESULTS_TO_DB
138 description: "Push the results of all the tests to the resultDB"
139 ########################
141 ########################
143 name: 'functest-master'
145 - pollscm: "H 9 * * *"
146 ########################
148 ########################
150 name: functest-daily-builder
155 # - 'functest-store-results'
158 name: functest-suite-builder
164 if [ "${PUSH_RESULTS_TO_DB}" == "true" ]; then
167 echo "Functest: run $FUNCTEST_SUITE_NAME"
168 cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh --test $FUNCTEST_SUITE_NAME ${flag}"
169 container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
170 docker exec $container_id $cmd
179 if [ "${PUSH_RESULTS_TO_DB}" == "true" ]; then
182 echo "Functest: running all the tests"
183 cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh ${flag}"
184 container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
185 docker exec $container_id $cmd
188 name: set-functest-env
193 if [[ ${INSTALLER_TYPE} == 'apex' ]]; then
194 INSTALLER_IP=$(grep instack /var/lib/libvirt/dnsmasq/default.leases \
195 |awk '{print $3}' | head -n 1)
196 sshkey="-v /root/.ssh/id_rsa:/root/.ssh/id_rsa"
198 echo "Functest: Start Docker and prepare environment"
199 envs="INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} -e NODE_NAME=${NODE_NAME}"
201 # If production lab then creds may be retrieved dynamically
202 # If dev lab, credentials may not be the default ones, just provide a path to put them into docker
203 if [ -n "${LAB_CONFIG}" ]; then
204 labconfig="-v ${LAB_CONFIG}:/home/opnfv/functest/conf/openstack.creds"
207 docker pull opnfv/functest:latest_stable
208 cmd="docker run -id -e $envs ${labconfig} ${sshkey} opnfv/functest:latest_stable /bin/bash"
209 echo "Functest: Running docker run command: ${cmd}"
213 container_id=$(docker ps | grep 'opnfv/functest:latest_stable' | awk '{print $1}' | head -1)
214 echo "Container ID=${container_id}"
215 if [ -z ${container_id} ]; then
216 echo "Cannot find opnfv/functest container ID ${container_id}. Please check if it is existing."
220 echo "Starting the container: docker start ${container_id}"
221 docker start ${container_id}
224 if [ $(docker ps | grep 'opnfv/functest:latest_stable' | wc -l) == 0 ]; then
225 echo "The container opnfv/functest with ID=${container_id} has not been properly started. Exiting..."
228 cmd="${FUNCTEST_REPO_DIR}/docker/prepare_env.sh"
229 echo "Executing command inside the docker: ${cmd}"
230 docker exec ${container_id} ${cmd}
233 name: functest-store-results
236 !include-raw res-build.sh
239 name: functest-cleanup
244 echo "Cleaning up docker containers/images..."
246 # Remove previous running containers if exist
247 if [[ ! -z $(docker ps -a | grep opnfv/functest) ]]; then
248 echo "Removing existing opnfv/functest containers..."
249 docker ps | grep opnfv/functest | awk '{print $1}' | xargs docker stop
250 docker ps -a | grep opnfv/functest | awk '{print $1}' | xargs docker rm
253 # Remove existing images if exist
254 if [[ ! -z $(docker images | grep opnfv/functest) ]]; then
255 echo "Docker images to remove:"
256 docker images | head -1 && docker images | grep opnfv/functest
257 image_tags=($(docker images | grep opnfv/functest | awk '{print $2}'))
258 for tag in "${image_tags[@]}"; do
259 echo "Removing docker image opnfv/functest:$tag..."
260 docker rmi opnfv/functest:$tag