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"
135 ########################
137 ########################
139 name: 'functest-master'
141 - pollscm: "H 9 * * *"
142 ########################
144 ########################
146 name: functest-daily-builder
151 # - 'functest-store-results'
154 name: functest-suite-builder
160 echo "Functest: run $FUNCTEST_SUITE_NAME"
161 cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh --test $FUNCTEST_SUITE_NAME"
162 container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
163 docker exec $container_id $cmd
172 echo "Functest: running all the tests"
173 cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh"
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 if [[ ${INSTALLER_TYPE} == 'apex' ]]; then
184 INSTALLER_IP=$(grep instack /var/lib/libvirt/dnsmasq/default.leases \
185 |awk '{print $3}' | head -n 1)
186 sshkey="-v /root/.ssh/id_rsa:/root/.ssh/id_rsa"
188 echo "Functest: Start Docker and prepare environment"
189 envs="INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} -e NODE_NAME=${NODE_NAME}"
191 # If production lab then creds may be retrieved dynamically
192 # If dev lab, credentials may not be the default ones, just provide a path to put them into docker
193 if [ -n "${LAB_CONFIG}" ]; then
194 labconfig="-v ${LAB_CONFIG}:/home/opnfv/functest/conf/openstack.creds"
197 docker pull opnfv/functest:latest_stable
198 cmd="docker run -id -e $envs ${labconfig} ${sshkey} opnfv/functest:latest_stable /bin/bash"
199 echo "Functest: Running docker run command: ${cmd}"
203 container_id=$(docker ps | grep 'opnfv/functest:latest_stable' | awk '{print $1}' | head -1)
204 echo "Container ID=${container_id}"
205 if [ -z ${container_id} ]; then
206 echo "Cannot find opnfv/functest container ID ${container_id}. Please check if it is existing."
210 echo "Starting the container: docker start ${container_id}"
211 docker start ${container_id}
214 if [ $(docker ps | grep 'opnfv/functest:latest_stable' | wc -l) == 0 ]; then
215 echo "The container opnfv/functest with ID=${container_id} has not been properly started. Exiting..."
218 cmd="${FUNCTEST_REPO_DIR}/docker/prepare_env.sh"
219 echo "Executing command inside the docker: ${cmd}"
220 docker exec ${container_id} ${cmd}
223 name: functest-store-results
226 !include-raw res-build.sh
229 name: functest-cleanup
234 echo "Cleaning up docker containers/images..."
236 # Remove previous running containers if exist
237 if [[ ! -z $(docker ps -a | grep opnfv/functest) ]]; then
238 echo "Removing existing opnfv/functest containers..."
239 docker ps | grep opnfv/functest | awk '{print $1}' | xargs docker stop
240 docker ps -a | grep opnfv/functest | awk '{print $1}' | xargs docker rm
243 # Remove existing images if exist
244 if [[ ! -z $(docker images | grep opnfv/functest) ]]; then
245 echo "Docker images to remove:"
246 docker images | head -1 && docker images | grep opnfv/functest
247 image_tags=($(docker images | grep opnfv/functest | awk '{print $2}'))
248 for tag in "${image_tags[@]}"; do
249 echo "Removing docker image opnfv/functest:$tag..."
250 docker rmi opnfv/functest:$tag