7 [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
8 FUNCTEST_DIR=/home/opnfv/functest
10 rc_file=${HOME}/k8.creds
13 if [[ ${INSTALLER_TYPE} == 'compass' ]]; then
14 admin_conf_file_vol="-v ${HOME}/admin.conf:/root/.kube/config"
15 echo "export KUBECONFIG=/root/.kube/config" >> $rc_file
16 echo "export KUBERNETES_PROVIDER=local" >> $rc_file
17 KUBE_MASTER_URL=$(cat ${HOME}/admin.conf|grep server| awk '{print $2}')
18 echo "export KUBE_MASTER_URL=$KUBE_MASTER_URL" >> $rc_file
19 KUBE_MASTER_IP=$(echo $KUBE_MASTER_URL|awk -F'https://|:[0-9]+' '$0=$2')
20 echo "export KUBE_MASTER_IP=$KUBE_MASTER_IP" >> $rc_file
21 elif [[ ${INSTALLER_TYPE} == 'joid' && ${BRANCH} == 'master' ]]; then
22 admin_conf_file_vol="-v ${HOME}/joid_config/config:/root/joid_config/config"
23 rc_file=${HOME}/joid_config/k8config
25 echo "Not supported by other installers yet"
29 rc_file_vol="-v ${rc_file}:${FUNCTEST_DIR}/conf/env_file"
31 dir_result="${HOME}/opnfv/functest/results/${BRANCH##*/}"
32 mkdir -p ${dir_result}
33 sudo rm -rf ${dir_result}/*
34 results_vol="-v ${dir_result}:${FUNCTEST_DIR}/results"
36 volumes="${rc_file_vol} ${results_vol} ${admin_conf_file_vol}"
38 # Set iptables rule to allow forwarding return traffic for container
39 if ! sudo iptables -C FORWARD -j RETURN 2> ${redirect} || ! sudo iptables -L FORWARD | awk 'NR==3' | grep RETURN 2> ${redirect}; then
40 sudo iptables -I FORWARD -j RETURN
43 envs="-e INSTALLER_TYPE=${INSTALLER_TYPE} \
44 -e NODE_NAME=${NODE_NAME} -e DEPLOY_SCENARIO=${DEPLOY_SCENARIO} \
45 -e BUILD_TAG=${BUILD_TAG} -e DEPLOY_TYPE=${DEPLOY_TYPE}"
47 DOCKER_TAG=`[[ ${BRANCH##*/} == "master" ]] && echo "latest" || echo ${BRANCH##*/}`
51 FUNCTEST_IMAGE=opnfv/functest-kubernetes:${DOCKER_TAG}
52 echo "Pulling Docker image ${FUNCTEST_IMAGE} ..."
53 docker pull ${FUNCTEST_IMAGE}>/dev/null
54 cmd_opt="run_tests -r -t all"
55 cmd="docker run --rm --privileged=true ${envs} ${volumes} ${FUNCTEST_IMAGE} /bin/bash -c '${cmd_opt}'"
56 echo "Running Functest k8s test cases, CMD: ${cmd}"
59 if [ ${ret_value} != 0 ]; then
60 echo ${ret_value} > ${ret_val_file}