fuel-plugin-scaleio/pre_build_hook

56 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# Add here any the actions which are required before plugin build
# like packages building, packages downloading from mirrors and so on.
# The script should return 0 if there were no errors.
#
# Define environment variable:
# - FORCE_DOWNLOAD - to force package downloading
# - FORCE_CLONE - to force re-cloning of puppet git reposintories
set -eux
RELEASE=${RELEASE_TAG:-"v1.2.0"}
BASE_PUPPET_URL="https://github.com/codedellemc"
##############################################################################
# Download required puppet modules
##############################################################################
GIT_REPOS=(puppet-scaleio puppet-scaleio-openstack)
DESTINATIONS=(scaleio scaleio_openstack)
for r in {0..1}
do
puppet_url="$BASE_PUPPET_URL/${GIT_REPOS[$r]}"
destination="./deployment_scripts/puppet/modules/${DESTINATIONS[$r]}"
if [[ ! -d "$destination" || ! -z "${FORCE_CLONE+x}" ]]
then
if [ ! -z "${FORCE_CLONE+x}" ]
then
rm -rf "$destination"
fi
git clone "$puppet_url" "$destination"
pushd "$destination"
if git tag -l | grep -q "$RELEASE" ; then
git checkout "tags/$RELEASE"
else
git checkout "$RELEASE"
fi
popd
else
if [ -z "${SKIP_PULL+x}" ]
then
pushd "$destination"
if git tag -l | grep -q "$RELEASE" ; then
git checkout "tags/$RELEASE"
else
git checkout "$RELEASE"
fi
popd
fi
fi
done