|
|
@ -77,16 +77,16 @@ verifySupported() {
|
|
|
|
|
|
|
|
|
|
|
|
# checkDesiredVersion checks if the desired version is available.
|
|
|
|
# checkDesiredVersion checks if the desired version is available.
|
|
|
|
checkDesiredVersion() {
|
|
|
|
checkDesiredVersion() {
|
|
|
|
# Use the GitHub releases webpage for the project to find the desired version for this project.
|
|
|
|
if [ "x$DESIRED_VERSION" == "x" ]; then
|
|
|
|
local release_url="https://github.com/helm/helm/releases/${DESIRED_VERSION:-latest}"
|
|
|
|
# Get tag from release URL
|
|
|
|
|
|
|
|
local latest_release_url="https://github.com/helm/helm/releases/latest"
|
|
|
|
if type "curl" > /dev/null; then
|
|
|
|
if type "curl" > /dev/null; then
|
|
|
|
TAG=$(curl -SsL $release_url | awk '/\/tag\//' | grep -v no-underline | grep "<a href=\"/helm/helm/releases" | head -n 1 | cut -d '"' -f 2 | awk '{n=split($NF,a,"/");print a[n]}' | awk 'a !~ $0{print}; {a=$0}')
|
|
|
|
TAG=$(curl -Ls -o /dev/null -w %{url_effective} $latest_release_url | grep -oE "[^/]+$" )
|
|
|
|
elif type "wget" > /dev/null; then
|
|
|
|
elif type "wget" > /dev/null; then
|
|
|
|
TAG=$(wget -q -O - $release_url | awk '/\/tag\//' | grep -v no-underline | grep "<a href=\"/helm/helm/releases" | head -n 1 | cut -d '"' -f 2 | awk '{n=split($NF,a,"/");print a[n]}' | awk 'a !~ $0{print}; {a=$0}')
|
|
|
|
TAG=$(wget $latest_release_url --server-response -O /dev/null 2>&1 | awk '/^ Location: /{DEST=$2} END{ print DEST}' | grep -oE "[^/]+$")
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ "x$TAG" == "x" ]; then
|
|
|
|
else
|
|
|
|
echo "Cannot determine ${DESIRED_VERSION} tag."
|
|
|
|
TAG=$DESIRED_VERSION
|
|
|
|
exit 1
|
|
|
|
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|