Skip to content

fix(build): download correct cloud-agent for arch #3331

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

Merged
merged 1 commit into from
May 10, 2021
Merged
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
20 changes: 19 additions & 1 deletion ci/build/npm-postinstall.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
#!/usr/bin/env sh
set -eu

# Copied from arch() in ci/lib.sh.
detect_arch() {
case "$(uname -m)" in
aarch64)
echo arm64
;;
x86_64 | amd64)
echo amd64
;;
*)
# This will cause the download to fail, but is intentional
uname -m
;;
esac
}

ARCH="${NPM_CONFIG_ARCH:-$(detect_arch)}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a big ol' nit but I'm thinking we should move this inside main to match OS.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will look at it for 3.11/3.10.1 - tested this locally for both amd64/arm64, and don't want to shake things up with changes on release day


main() {
# Grabs the major version of node from $npm_config_user_agent which looks like
# yarn/1.21.1 npm/? node/v14.2.0 darwin x64
Expand All @@ -25,7 +43,7 @@ main() {
esac

OS="$(uname | tr '[:upper:]' '[:lower:]')"
if curl -fsSL "https://storage.googleapis.com/coder-cloud-releases/agent/latest/$OS/cloud-agent" -o ./lib/coder-cloud-agent; then
if curl -fsSL "https://github.com/cdr/cloud-agent/releases/latest/download/cloud-agent-$OS-$ARCH" -o ./lib/coder-cloud-agent; then
chmod +x ./lib/coder-cloud-agent
else
echo "Failed to download cloud agent; --link will not work"
Expand Down