Skip to content

Commit

Permalink
fix: support multi-arch (#129)
Browse files Browse the repository at this point in the history
Adapt install_plugin.sh to download the correct binary. Otherwise the
binary for amd64 systems will be downloaded on systems with a different
target architecture and the execution of helm cm-push throws an exec
format error.

If the release can not be found for the target architecture, the install
script throws an error.
  • Loading branch information
volker-raschek authored Feb 3, 2022
1 parent add6b6e commit b36e98c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ builds:
- windows
goarch:
- amd64
- arm
- arm64
goarm:
- "6"
- "7"

archives:
- id: tarball
Expand Down
26 changes: 22 additions & 4 deletions scripts/install_plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,31 @@ version="$(cat plugin.yaml | grep "version" | cut -d '"' -f 2)"
echo "Downloading and installing helm-push v${version} ..."

url=""

arch=""
case $(uname -m) in
x86_64)
arch="amd64"
;;
arm*)
arch="arm"
;;
aarch64)
arch="arm64"
;;
*)
echo "Failed to detect target architecture"
exit 1
;;
esac


if [ "$(uname)" = "Darwin" ]; then
url="https://github.com/chartmuseum/helm-push/releases/download/v${version}/helm-push_${version}_darwin_amd64.tar.gz"
url="https://github.com/chartmuseum/helm-push/releases/download/v${version}/helm-push_${version}_darwin_${arch}.tar.gz"
elif [ "$(uname)" = "Linux" ] ; then
url="https://github.com/chartmuseum/helm-push/releases/download/v${version}/helm-push_${version}_linux_amd64.tar.gz"
url="https://github.com/chartmuseum/helm-push/releases/download/v${version}/helm-push_${version}_linux_${arch}.tar.gz"
else
url="https://github.com/chartmuseum/helm-push/releases/download/v${version}/helm-push_${version}_windows_amd64.tar.gz"
url="https://github.com/chartmuseum/helm-push/releases/download/v${version}/helm-push_${version}_windows_${arch}.tar.gz"
fi

echo $url
Expand All @@ -33,4 +52,3 @@ fi
tar xzf "releases/v${version}.tar.gz" -C "releases/v${version}"
mv "releases/v${version}/bin/helm-cm-push" "bin/helm-cm-push" || \
mv "releases/v${version}/bin/helm-cm-push.exe" "bin/helm-cm-push"

0 comments on commit b36e98c

Please sign in to comment.