Fix curl error Failed writing body

Do not close the pipe early, output only the first version found.  wget command changed for consistency.
Fixes #2802
pull/2803/head
Tim H 7 years ago committed by GitHub
parent 176228a6a7
commit b914958b96

@ -78,9 +78,9 @@ checkDesiredVersion() {
# Use the GitHub releases webpage for the project to find the desired version for this project.
local release_url="https://github.com/kubernetes/helm/releases/${DESIRED_VERSION:-latest}"
if type "curl" > /dev/null; then
TAG=$(curl -SsL $release_url | awk '/\/tag\//' | head -n 1 | cut -d '"' -f 2 | awk '{n=split($NF,a,"/");print a[n]}')
TAG=$(curl -SsL $release_url | awk '/\/tag\//' | cut -d '"' -f 2 | awk '{n=split($NF,a,"/");print a[n]}' | awk 'a !~ $0{print}; {a=$0}')
elif type "wget" > /dev/null; then
TAG=$(wget -q -O - $release_url | awk '/\/tag\//' | head -n 1 | cut -d '"' -f 2 | awk '{n=split($NF,a,"/");print a[n]}')
TAG=$(wget -q -O - $release_url | awk '/\/tag\//' | cut -d '"' -f 2 | awk '{n=split($NF,a,"/");print a[n]}' | awk 'a !~ $0{print}; {a=$0}')
fi
if [ "x$TAG" == "x" ]; then
echo "Cannot determine ${DESIRED_VERSION} tag."

Loading…
Cancel
Save