X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=jjb%2Ffunctest%2Fset-functest-env.sh;h=f581f2604d326c0e9d50d1c72ad027b120423ac1;hb=b78fb39202a79da6b88cede2da4dac696b31011f;hp=1acf0a2adfd8eaff25e9847d2ad5c9fb03c3ec87;hpb=e5ac61a101fe8f5ecda29ac9008225b86c635026;p=releng.git diff --git a/jjb/functest/set-functest-env.sh b/jjb/functest/set-functest-env.sh index 1acf0a2ad..f581f2604 100755 --- a/jjb/functest/set-functest-env.sh +++ b/jjb/functest/set-functest-env.sh @@ -2,25 +2,8 @@ set -e [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null" -# LAB_CONFIG is used only for joid - - -if [[ ${INSTALLER_TYPE} == 'joid' ]]; then - # If production lab then creds may be retrieved dynamically - # creds are on the jumphost, always in the same folder - rc_file_vol="-v $LAB_CONFIG/admin-openrc:/home/opnfv/functest/conf/openstack.creds" - # If dev lab, credentials may not be the default ones, just provide a path to put them into docker - # replace the default one by the customized one provided by jenkins config -fi - -if [[ ${RC_FILE_PATH} != '' ]] && [[ -f ${RC_FILE_PATH} ]] ; then - echo "Credentials file detected: ${RC_FILE_PATH}" - # volume if credentials file path is given to Functest - rc_file_vol="-v ${RC_FILE_PATH}:/home/opnfv/functest/conf/openstack.creds" - RC_FLAG=1 -fi - +# 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 @@ -38,16 +21,25 @@ if [[ ${INSTALLER_TYPE} == 'apex' ]]; then 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 - elif [[ "$RC_FLAG" == 1 ]]; then - echo "No available installer VM, but credentials provided...continuing" else echo "No available installer VM exists and no credentials provided...exiting" exit 1 fi - fi +# Prepare OpenStack credentials volume +if [[ ${INSTALLER_TYPE} == 'joid' ]]; then + rc_file_vol="-v $LAB_CONFIG/admin-openrc:/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" +fi + # Set iptables rule to allow forwarding return traffic for container if ! sudo iptables -C FORWARD -j RETURN 2> ${redirect} || ! sudo iptables -L FORWARD | awk 'NR==3' | grep RETURN 2> ${redirect}; then @@ -59,6 +51,12 @@ DEPLOY_TYPE=baremetal 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} 2> ${redirect} +images_vol="-v ${images_dir}:/home/opnfv/functest/images" + dir_result="${HOME}/opnfv/functest/results/${BRANCH##*/}" mkdir -p ${dir_result} sudo rm -rf ${dir_result}/* @@ -80,7 +78,7 @@ if [[ ${INSTALLER_TYPE} == 'compass' && ${DEPLOY_SCENARIO} == *'os-nosdn-openo-h envs=${env}" -e OPENO_MSB_ENDPOINT=${openo_msb_endpoint}" fi -volumes="${results_vol} ${sshkey_vol} ${stackrc_vol} ${rc_file_vol}" +volumes="${images_vol} ${results_vol} ${sshkey_vol} ${stackrc_vol} ${rc_file_vol}" HOST_ARCH=$(uname -m) FUNCTEST_IMAGE="opnfv/functest" @@ -88,7 +86,7 @@ if [ "$HOST_ARCH" = "aarch64" ]; then FUNCTEST_IMAGE="${FUNCTEST_IMAGE}_${HOST_ARCH}" fi -echo "Functest: Pulling image ${FUNCTEST_IMAGE}:${DOCKER_TAG}" +echo "Functest: Pulling Functest Docker image ${FUNCTEST_IMAGE}:${DOCKER_TAG}" docker pull ${FUNCTEST_IMAGE}:$DOCKER_TAG >/dev/null cmd="sudo docker run --privileged=true -id ${envs} ${volumes} \