fix(scripts): use a more precise method of grepping

Github recently changed the output of the releases page.

grepping for the exact <a> tag fixes the issue where the wrong tag was being filtered.

Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
pull/5478/head
Matthew Fisher 7 years ago
parent 465f56f83f
commit ab9cc982a0
No known key found for this signature in database
GPG Key ID: 92AA783CBAAE8E3B

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

Loading…
Cancel
Save