Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds native binary support for Darwin Arm64 (e.g. M1 Mac) #826

Merged
merged 2 commits into from
Nov 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/dapr_cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ jobs:
target_arch: arm64
- os: macOS-latest
target_arch: arm
- os: macOS-latest
target_arch: arm64
steps:
- name: Set up Go ${{ env.GOVER }}
uses: actions/setup-go@v2
Expand Down
37 changes: 31 additions & 6 deletions install/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,16 @@ verifySupported() {
done

if [ "$current_osarch" == "darwin-arm64" ]; then
echo "The darwin_arm64 arch has no native binary, however you can use the amd64 version so long as you have rosetta installed"
echo "Use 'softwareupdate --install-rosetta' to install rosetta if you don't already have it"
ARCH="amd64"
return
if isReleaseAvailable; then
return
else
echo "The darwin_arm64 arch has no native binary for this version of Dapr, however you can use the amd64 version so long as you have rosetta installed"
echo "Use 'softwareupdate --install-rosetta' to install rosetta if you don't already have it"
ARCH="amd64"
return
fi
fi


echo "No prebuilt binary for ${current_osarch}"
exit 1
}
Expand Down Expand Up @@ -133,6 +136,28 @@ downloadFile() {
fi
}

isReleaseAvailable() {
LATEST_RELEASE_TAG=$1

DAPR_CLI_ARTIFACT="${DAPR_CLI_FILENAME}_${OS}_${ARCH}.tar.gz"
DOWNLOAD_BASE="https://github.com/${GITHUB_ORG}/${GITHUB_REPO}/releases/download"
DOWNLOAD_URL="${DOWNLOAD_BASE}/${LATEST_RELEASE_TAG}/${DAPR_CLI_ARTIFACT}"

if [ "$DAPR_HTTP_REQUEST_CLI" == "curl" ]; then
httpstatus=$(curl -sSLI -o /dev/null -w "%{http_code}" "$DOWNLOAD_URL")
if [ "$httpstatus" == "200" ]; then
return 0
fi
else
wget -q --spider "$DOWNLOAD_URL"
exitstatus=$?
if [ $exitstatus -eq 0 ]; then
return 0
fi
fi
return 1
}

installFile() {
tar xf "$ARTIFACT_TMP_FILE" -C "$DAPR_TMP_ROOT"
local tmp_root_dapr_cli="$DAPR_TMP_ROOT/$DAPR_CLI_FILENAME"
Expand Down Expand Up @@ -181,9 +206,9 @@ installCompleted() {
trap "fail_trap" EXIT

getSystemInfo
checkHttpRequestCLI
verifySupported
checkExistingDapr
checkHttpRequestCLI


if [ -z "$1" ]; then
Expand Down