Remove Onos in Functest
[functest.git] / docs / testing / user / configguide / ci.rst
1 Integration in CI
2 =================
3 In CI we use the Docker image and execute the appropriate commands within the
4 container from Jenkins.
5
6 Docker creation in set-functest-env builder `[3]`_::
7
8     envs="-e INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} -e NODE_NAME=${NODE_NAME}"
9     [...]
10     docker pull opnfv/functest:$DOCKER_TAG >/dev/null
11     cmd="sudo docker run -id ${envs} ${volumes} ${custom_params} ${TESTCASE_OPTIONS} opnfv/functest:${DOCKER_TAG} /bin/bash"
12     echo "Functest: Running docker run command: ${cmd}"
13     ${cmd} >${redirect}
14     sleep 5
15     container_id=$(docker ps | grep "opnfv/functest:${DOCKER_TAG}" | awk '{print $1}' | head -1)
16     echo "Container ID=${container_id}"
17     if [ -z ${container_id} ]; then
18         echo "Cannot find opnfv/functest container ID ${container_id}. Please check if it is existing."
19         docker ps -a
20         exit 1
21     fi
22     echo "Starting the container: docker start ${container_id}"
23     docker start ${container_id}
24     sleep 5
25     docker ps >${redirect}
26     if [ $(docker ps | grep "opnfv/functest:${DOCKER_TAG}" | wc -l) == 0 ]; then
27         echo "The container opnfv/functest with ID=${container_id} has not been properly started. Exiting..."
28         exit 1
29     fi
30
31     cmd="python ${FUNCTEST_REPO_DIR}/functest/ci/prepare_env.py start"
32     echo "Executing command inside the docker: ${cmd}"
33     docker exec ${container_id} ${cmd}
34
35
36 Test execution in functest-all builder `[3]`_::
37
38     branch=${GIT_BRANCH##*/}
39     echo "Functest: run $FUNCTEST_SUITE_NAME on branch ${branch}"
40     cmd="functest testcase run $FUNCTEST_SUITE_NAME"
41     fi
42     container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
43     docker exec $container_id $cmd
44     ret_value=$?
45     exit $ret_value
46
47 Docker clean in functest-cleanup builder `[3]`_ calling docker rm and docker rmi
48
49
50 .. _`[3]`: https://git.opnfv.org/releng/tree/jjb/functest/functest-daily-jobs.yml