Skip to content

Commit 4790fb1

Browse files
dschaaffmumoshu
andauthored
Add linux/arm64 support (#267)
* Update install-binary.sh add linux-arm64 to supported architectures * update dist to include linux arm 64 Signed-off-by: Daniel Schaaff <[email protected]> * put url back to mainline repo Signed-off-by: Daniel Schaaff <[email protected]> * remove macos arm from install.sh since I don't have a way to verify rosetta works Signed-off-by: Daniel Schaaff <[email protected]> * add fallback logic to continue working for installing older versions * fix typo Signed-off-by: Daniel Schaaff <[email protected]> Co-authored-by: Yusuke Kuoka <[email protected]>
1 parent 97f7749 commit 4790fb1

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,16 @@ dist:
6363
mkdir -p build/diff/bin release/
6464
cp README.md LICENSE plugin.yaml build/diff
6565
GOOS=linux GOARCH=amd64 go build -o build/diff/bin/diff -trimpath -ldflags="$(LDFLAGS)"
66-
tar -C build/ -zcvf $(CURDIR)/release/helm-diff-linux.tgz diff/
66+
tar -C build/ -zcvf $(CURDIR)/release/helm-diff-linux-amd64.tgz diff/
67+
GOOS=linux GOARCH=arm64 go build -o build/diff/bin/diff -trimpath -ldflags="$(LDFLAGS)"
68+
tar -C build/ -zcvf $(CURDIR)/release/helm-diff-linux-arm64.tgz diff/
6769
GOOS=freebsd GOARCH=amd64 go build -o build/diff/bin/diff -trimpath -ldflags="$(LDFLAGS)"
68-
tar -C build/ -zcvf $(CURDIR)/release/helm-diff-freebsd.tgz diff/
70+
tar -C build/ -zcvf $(CURDIR)/release/helm-diff-freebsd-amd64.tgz diff/
6971
GOOS=darwin GOARCH=amd64 go build -o build/diff/bin/diff -trimpath -ldflags="$(LDFLAGS)"
70-
tar -C build/ -zcvf $(CURDIR)/release/helm-diff-macos.tgz diff/
72+
tar -C build/ -zcvf $(CURDIR)/release/helm-diff-macos-amd64.tgz diff/
7173
rm build/diff/bin/diff
7274
GOOS=windows GOARCH=amd64 go build -o build/diff/bin/diff.exe -trimpath -ldflags="$(LDFLAGS)"
73-
tar -C build/ -zcvf $(CURDIR)/release/helm-diff-windows.tgz diff/
75+
tar -C build/ -zcvf $(CURDIR)/release/helm-diff-windows-amd64.tgz diff/
7476

7577
.PHONY: release
7678
release: lint dist

install-binary.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ initOS() {
5555
# verifySupported checks that the os/arch combination is supported for
5656
# binary builds.
5757
verifySupported() {
58-
supported="linux-amd64\nfreebsd-amd64\nmacos-amd64\nmacos-arm64\nwindows-amd64"
58+
supported="linux-amd64\nlinux-arm64\nfreebsd-amd64\nmacos-amd64\nmacos-arm64\nwindows-amd64"
5959
if ! echo "${supported}" | grep -q "${OS}-${ARCH}"; then
6060
echo "No prebuild binary for ${OS}-${ARCH}."
6161
exit 1
@@ -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" -gt "3.1.3" ]; then
74+
DOWNLOAD_URL="https://github.com/$PROJECT_GH/releases/download/$version/helm-diff-$OS-$ARCH.tgz"
75+
elif [ -n "$version" ]; then
7476
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)