rancher-charts/scripts/pull-scripts

47 lines
1.3 KiB
Plaintext
Raw Normal View History

#!/bin/bash
set -e
cd $(dirname $0)
2021-02-08 21:33:55 +00:00
source ./version
2021-06-08 20:07:41 +00:00
if ls ../bin/charts-build-scripts 1>/dev/null 2>/dev/null; then
CURRENT_SCRIPT_VERSION=$(../bin/charts-build-scripts --version | cut -d' ' -f3)
if [[ "${CURRENT_SCRIPT_VERSION}" == "${CHARTS_BUILD_SCRIPT_VERSION}" ]]; then
exit 0
fi
fi
2021-05-17 22:27:35 +00:00
echo "Pulling in charts-build-scripts version ${CHARTS_BUILD_SCRIPTS_REPO}@${CHARTS_BUILD_SCRIPT_VERSION}"
rm -rf ../bin
cd ..
2021-06-08 20:07:41 +00:00
mkdir -p bin
ARCH=$(go version | cut -d' ' -f4 | cut -d'/' -f1)
if [[ ${ARCH} == "linux" ]]; then
BINARY_NAME=charts-build-scripts
else
BINARY_NAME=charts-build-scripts-${ARCH}
fi
curl -s -L ${CHARTS_BUILD_SCRIPTS_REPO%.git}/releases/download/${CHARTS_BUILD_SCRIPT_VERSION}/${BINARY_NAME} --output bin/charts-build-scripts
if ! [[ -f bin/charts-build-scripts ]] || [[ $(cat bin/charts-build-scripts) == "Not Found" ]]; then
rm bin/charts-build-scripts;
# Fall back to old process
echo "Building binary locally..."
rm -rf charts-build-scripts
git clone --depth 1 --branch $CHARTS_BUILD_SCRIPT_VERSION $CHARTS_BUILD_SCRIPTS_REPO 2>/dev/null
2021-06-08 20:07:41 +00:00
cd charts-build-scripts
./scripts/build
mv bin ..
cd ..
rm -rf charts-build-scripts
else
echo "${BINARY_NAME} => ./bin/charts-build-scripts"
fi
chmod +x ./bin/charts-build-scripts
2021-06-08 20:07:41 +00:00
./bin/charts-build-scripts --version