Replace call to Github HTTP API with normal Github URL

pull/2324/head
Jorge Marin 8 years ago
parent 7309c1a7dd
commit 037ff5b51c

@ -65,11 +65,15 @@ verifySupported() {
# checkLatestVersion checks the latest available version. # checkLatestVersion checks the latest available version.
checkLatestVersion() { checkLatestVersion() {
# Use the GitHub API to find the latest version for this project. # Use the GitHub API to find the latest version for this project.
local latest_url="https://api.github.com/repos/kubernetes/helm/releases/latest" local latest_url="https://github.com/kubernetes/helm/releases/latest"
if type "curl" > /dev/null; then if type "curl" > /dev/null; then
TAG=$(curl -s $latest_url | awk '/\"tag_name\":/{gsub( /[,\"]/,"", $2); print $2}') TAG=$(curl -SsL $latest_url | awk '/\/tag\//' | head -n 1 | cut -d '"' -f 2 | awk '{n=split($NF,a,"/");print a[n]}')
elif type "wget" > /dev/null; then elif type "wget" > /dev/null; then
TAG=$(wget -q -O - $latest_url | awk '/\"tag_name\":/{gsub( /[,\"]/,"", $2); print $2}') TAG=$(wget -q -O - $latest_url | awk '/\/tag\//' | head -n 1 | cut -d '"' -f 2 | awk '{n=split($NF,a,"/");print a[n]}')
fi
if [ "x$TAG" == "x" ]; then
echo "Cannot determine latest tag."
exit 1
fi fi
} }

Loading…
Cancel
Save