Skip to content

Commit ed371b6

Browse files
dschaaffAnton Bretting
authored andcommitted
add fallback logic to continue working for installing older versions
1 parent 134c949 commit ed371b6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

install-binary.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,17 @@ verifySupported() {
7070
# getDownloadURL checks the latest available version.
7171
getDownloadURL() {
7272
version=$(git -C "$HELM_PLUGIN_DIR" describe --tags --exact-match 2>/dev/null || :)
73-
if [ -n "$version" ]; then
73+
if [ -n "$version" ] && [ "$version" -ge "3.1.3" ]; then
7474
DOWNLOAD_URL="https://github.com/$PROJECT_GH/releases/download/$version/helm-diff-$OS-$ARCH.tgz"
75+
elif [ -n "$version" ]; then
76+
DOWNLOAD_URL="https://github.com/$PROJECT_GH/releases/download/$version/helm-diff-$OS.tgz"
7577
else
7678
# Use the GitHub API to find the download url for this project.
7779
url="https://api.github.com/repos/$PROJECT_GH/releases/latest"
7880
if type "curl" >/dev/null; then
79-
DOWNLOAD_URL=$(curl -s $url | grep $OS | awk '/\"browser_download_url\":/{gsub( /[,\"]/,"", $2); print $2}')
81+
DOWNLOAD_URL=$(curl -s $url | grep $OS | grep $ARCH | awk '/\"browser_download_url\":/{gsub( /[,\"]/,"", $2); print $2}')
8082
elif type "wget" >/dev/null; then
81-
DOWNLOAD_URL=$(wget -q -O - $url | grep $OS | awk '/\"browser_download_url\":/{gsub( /[,\"]/,"", $2); print $2}')
83+
DOWNLOAD_URL=$(wget -q -O - $url | grep $OS | grep $ARCH | awk '/\"browser_download_url\":/{gsub( /[,\"]/,"", $2); print $2}')
8284
fi
8385
fi
8486
}

0 commit comments

Comments
 (0)