echo "--------------------------"
echo
+if [ -z "$SNAP_TYPE" ]; then
+ echo "ERROR: SNAP_TYPE not provided...exiting"
+ exit 1
+fi
+
echo "Cleaning server"
pushd ci > /dev/null
sudo opnfv-clean
popd > /dev/null
-full_snap_url=http://$GS_URL/${OS_VERSION}/${TOPOLOGY}
+full_snap_url="gs://${GS_URL}/${OS_VERSION}/${TOPOLOGY}"
echo "Downloading latest snapshot properties file"
-if ! wget -O $WORKSPACE/opnfv.properties ${full_snap_url}/snapshot.properties; then
+if ! gsutil cp ${full_snap_url}/snapshot.properties $WORKSPACE/opnfv.properties; then
echo "ERROR: Unable to find snapshot.properties at ${full_snap_url}...exiting"
exit 1
fi
cat ${WORKSPACE}/opnfv.properties
# find latest check sum
-latest_snap_checksum=$(cat ${WORKSPACE}/opnfv.properties | grep OPNFV_SNAP_SHA512SUM | awk -F "=" '{print $2}')
+latest_snap_checksum=$(cat ${WORKSPACE}/opnfv.properties | grep ${SNAP_TYPE}_SNAP_SHA512SUM | awk -F "=" '{print $2}')
if [ -z "$latest_snap_checksum" ]; then
echo "ERROR: checksum of latest snapshot from snapshot.properties is null!"
exit 1
# check snap cache directory exists
# if snapshot cache exists, find the checksum
if [ -d "$SNAP_CACHE" ]; then
- latest_snap=$(ls ${SNAP_CACHE} | grep tar.gz | tail -n 1)
+ latest_snap=$(ls ${SNAP_CACHE} | grep tar.gz | grep $SNAP_TYPE | tail -n 1)
if [ -n "$latest_snap" ]; then
local_snap_checksum=$(sha512sum ${SNAP_CACHE}/${latest_snap} | cut -d' ' -f1)
+ echo "Local snap checksum is: ${local_snap_checksum}"
fi
else
mkdir -p ${SNAP_CACHE}
# compare check sum and download latest snap if not up to date
if [ "$local_snap_checksum" != "$latest_snap_checksum" ]; then
- snap_url=$(cat opnfv.properties | grep OPNFV_SNAP_URL | awk -F "=" '{print $2}')
+ snap_url=$(cat opnfv.properties | grep ${SNAP_TYPE}_SNAP_URL | awk -F "=" '{print $2}')
+ # TODO(trozet): Remove this once OPNFV url is deprecated
+ if [[ -z "$snap_url" && "$SNAP_TYPE" == 'csit' ]]; then
+ echo "WARN: Unable to find snap url for ${SNAP_TYPE}, attempting to use OPNFV"
+ snap_url=$(cat opnfv.properties | grep OPNFV_SNAP_URL | awk -F "=" '{print $2}')
+ fi
if [ -z "$snap_url" ]; then
echo "ERROR: Snap URL from snapshot.properties is null!"
exit 1
echo "INFO: SHA mismatch, will download latest snapshot"
# wipe cache
rm -rf ${SNAP_CACHE}/*
- wget --directory-prefix=${SNAP_CACHE}/ ${snap_url}
+ gsutil cp "gs://${snap_url}" ${SNAP_CACHE}/
snap_tar=$(basename ${snap_url})
else
snap_tar=${latest_snap}