89 lines
2.6 KiB
Bash
Executable File
89 lines
2.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.0.0"}
|
|
|
|
#TODO: use ftp.emc.com
|
|
BASE_REPO_URL="http://scaleio-packages.s3-website-us-east-1.amazonaws.com"
|
|
BASE_PUPPET_URL="https://github.com/emccode"
|
|
|
|
##############################################################################
|
|
# Download packages for plugin
|
|
##############################################################################
|
|
PLATFORMS=(ubuntu centos)
|
|
PLATFORMS_PKG_SUFFIX=(deb rpm)
|
|
PLATFORMS_REPO_URL_SUFFIX=("pool/main/e" "centos/x86_64/RPMS")
|
|
|
|
for r in {0..1}
|
|
do
|
|
platform=${PLATFORMS[$r]}
|
|
repo_suffix=${PLATFORMS_REPO_URL_SUFFIX[$r]}
|
|
pkg_suffix=${PLATFORMS_PKG_SUFFIX[$r]}
|
|
|
|
repo_url="$BASE_REPO_URL/$platform/$repo_suffix/"
|
|
destination="./repositories/$platform"
|
|
|
|
components=`curl --silent "$repo_url" | grep -o 'emc-scaleio-\w\+' | sort| uniq`
|
|
|
|
for i in $components;
|
|
do
|
|
packages=`curl --silent "$repo_url$i/" | grep -o "$i[a-zA-Z0-9_.-]\+\.$pkg_suffix" | sort | uniq`
|
|
for p in $packages
|
|
do
|
|
if [[ ! -f "$destination/$p" || ! -z "${FORCE_DOWNLOAD+x}" ]]
|
|
then
|
|
wget -P "$destination/" "$repo_url$i/$p"
|
|
fi
|
|
done
|
|
done
|
|
done
|
|
|
|
##############################################################################
|
|
# 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
|