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

build: canonicalize to EC2 machine architecture #932

Merged
merged 1 commit into from
May 22, 2020
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
16 changes: 15 additions & 1 deletion bin/amiize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Required:
--ssh-keypair The SSH keypair name that's registered with EC2, to connect to worker instance
--instance-type Instance type launched for worker instance
--name The name under which to register the AMI
--arch The machine architecture of the AMI, e.g. x86_64
--arch The machine architecture of the AMI, e.g. x86_64, arm64
Optional:
--description The description attached to the registered AMI (defaults to name)
Expand Down Expand Up @@ -187,6 +187,20 @@ parse_args() {
required_arg "--name" "${NAME}"
required_arg "--arch" "${ARCH}"

# Validate and canonicalize architecture identifier.
case "${ARCH,,}" in
arm64|aarch64)
ARCH=arm64
;;
x86_64|amd64)
ARCH=x86_64
;;
*)
echo "ERROR: Unsupported EC2 machine architecture: $ARCH" >&2
usage
exit 2
esac

# Other argument checks
if [ ! -r "${ROOT_IMAGE}" ] ; then
echo "ERROR: cannot read ${ROOT_IMAGE}" >&2
Expand Down