#!/bin/bash
set -e
-[[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
-
-# Fetch INSTALLER_IP for APEX deployments
-if [[ ${INSTALLER_TYPE} == 'apex' ]]; then
- ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
- if sudo virsh list | grep undercloud; then
- echo "Installer VM detected"
- undercloud_mac=$(sudo virsh domiflist undercloud | grep default | \
- grep -Eo "[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+")
- INSTALLER_IP=$(/usr/sbin/arp -e | grep ${undercloud_mac} | awk {'print $1'})
- sshkey_vol="-v /root/.ssh/id_rsa:/root/.ssh/id_rsa"
- sudo scp $ssh_options root@${INSTALLER_IP}:/home/stack/stackrc ${HOME}/stackrc
- stackrc_vol="-v ${HOME}/stackrc:/home/opnfv/functest/conf/stackrc"
-
- if sudo iptables -C FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable 2> ${redirect}; then
- sudo iptables -D FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable
- fi
- if sudo iptables -C FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable 2> ${redirect}; then
- sudo iptables -D FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable
- fi
- else
- echo "No available installer VM exists and no credentials provided...exiting"
- exit 1
- fi
-fi
+set +u
+set +o pipefail
+[[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
# Prepare OpenStack credentials volume
if [[ ${INSTALLER_TYPE} == 'joid' ]]; then
rc_file_vol="-v $LAB_CONFIG/admin-openrc:/home/opnfv/functest/conf/openstack.creds"
+elif [[ ${INSTALLER_TYPE} == 'compass' && ${BRANCH} == 'master' ]]; then
+ cacert_file_vol="-v ${HOME}/os_cacert:/home/opnfv/functest/conf/os_cacert"
+ echo "export OS_CACERT=/home/opnfv/functest/conf/os_cacert" >> ${HOME}/opnfv-openrc.sh
+ rc_file_vol="-v ${HOME}/opnfv-openrc.sh:/home/opnfv/functest/conf/openstack.creds"
else
- ../../utils/fetch_os_creds.sh -d ${HOME}/rc_file -i ${INSTALLER_TYPE} -a ${INSTALLER_IP}
- if [ $? -ne 0 ]; then
- echo "Failed to fetch the credentials from the installer..."
- exit 1
- fi
- rc_file_vol="-v ${HOME}/rc_file:/home/opnfv/functest/conf/openstack.creds"
+ rc_file_vol="-v ${HOME}/opnfv-openrc.sh:/home/opnfv/functest/conf/openstack.creds"
fi
DEPLOY_TYPE=baremetal
[[ $BUILD_TAG =~ "virtual" ]] && DEPLOY_TYPE=virt
+HOST_ARCH=$(uname -m)
echo "Functest: Start Docker and prepare environment"
-echo "Functest: Download images that will be used by test cases"
-images_dir="${HOME}/opnfv/functest/images"
-chmod +x ${WORKSPACE}/functest/ci/download_images.sh
-${WORKSPACE}/functest/ci/download_images.sh ${images_dir}
-images_vol="-v ${images_dir}:/home/opnfv/functest/images"
+if [ "$BRANCH" != 'stable/danube' ]; then
+ echo "Functest: Download images that will be used by test cases"
+ images_dir="${HOME}/opnfv/functest/images"
+ chmod +x ${WORKSPACE}/functest/ci/download_images.sh
+ ${WORKSPACE}/functest/ci/download_images.sh ${images_dir} ${DEPLOY_SCENARIO} ${HOST_ARCH} 2> ${redirect}
+ images_vol="-v ${images_dir}:/home/opnfv/functest/images"
+fi
dir_result="${HOME}/opnfv/functest/results/${BRANCH##*/}"
mkdir -p ${dir_result}
-e NODE_NAME=${NODE_NAME} -e DEPLOY_SCENARIO=${DEPLOY_SCENARIO} \
-e BUILD_TAG=${BUILD_TAG} -e CI_DEBUG=${CI_DEBUG} -e DEPLOY_TYPE=${DEPLOY_TYPE}"
+if [[ ${INSTALLER_TYPE} == 'fuel' && ! -z ${SALT_MASTER_IP} ]]; then
+ HOST_ARCH=$(ssh -l ubuntu ${SALT_MASTER_IP} -i ${SSH_KEY} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
+ "sudo salt 'cmp*' grains.get cpuarch --out yaml |awk '{print \$2; exit}'")
+ envs="${envs} -e POD_ARCH=${HOST_ARCH}"
+fi
+
if [[ ${INSTALLER_TYPE} == 'compass' && ${DEPLOY_SCENARIO} == *'os-nosdn-openo-ha'* ]]; then
ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
openo_msb_port=${openo_msb_port:-80}
envs=${env}" -e OPENO_MSB_ENDPOINT=${openo_msb_endpoint}"
fi
-volumes="${images_vol} ${results_vol} ${sshkey_vol} ${stackrc_vol} ${rc_file_vol}"
+if [ "$BRANCH" != 'stable/danube' ]; then
+ volumes="${images_vol} ${results_vol} ${sshkey_vol} ${stackrc_vol} ${rc_file_vol} ${cacert_file_vol}"
+else
+ volumes="${results_vol} ${sshkey_vol} ${stackrc_vol} ${rc_file_vol}"
+fi
-HOST_ARCH=$(uname -m)
FUNCTEST_IMAGE="opnfv/functest"
if [ "$HOST_ARCH" = "aarch64" ]; then
FUNCTEST_IMAGE="${FUNCTEST_IMAGE}_${HOST_ARCH}"
exit 1
fi
-cmd="python ${FUNCTEST_REPO_DIR}/functest/ci/prepare_env.py start"
+if [ "$BRANCH" == 'master' ]; then
+ cmd="prepare_env start"
+else
+ cmd="python ${FUNCTEST_REPO_DIR}/functest/ci/prepare_env.py start"
+fi
+
echo "Executing command inside the docker: ${cmd}"
docker exec ${container_id} ${cmd}