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

Makefile: Check that $BUILDSYS_ARCH is a supported architecture #1167

Merged
merged 2 commits into from
Oct 21, 2020

Conversation

zmrow
Copy link
Contributor

@zmrow zmrow commented Oct 16, 2020

Issue number:
Related to #1162

Description of changes:

$BUILDSYS_ARCH is used all over the place in the Makefile, and if we don't
check that it's a valid supported architecture first, spurious directories get
created and commands further down the line will fail.  This change checks
$BUILDSYS_ARCH first before anything happens and fails.

    
It doesn't use any parameter expansion like the previous check did, meaning it
will be compatible with all versions of bash.

Testing done:

  • cargo make commands fail if an invalid arch is supplied via -e BUILDSYS_ARCH=
...
[cargo-make] INFO - Running Task: setup
Unrecognized architecture 'bar'; please use 'x86_64 or 'aarch64'
...
  • cargo make commands with valid architectures work as expected.

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

@zmrow
Copy link
Contributor Author

zmrow commented Oct 16, 2020

^ Fixed a typo

Makefile.toml Outdated Show resolved Hide resolved
@zmrow
Copy link
Contributor Author

zmrow commented Oct 16, 2020

^ style points

@izaakschroeder
Copy link

Exciting, thank-you! ❤️

tjkirch
tjkirch previously approved these changes Oct 16, 2020
@tjkirch tjkirch self-requested a review October 16, 2020 23:07
@tjkirch tjkirch dismissed their stale review October 16, 2020 23:07

(Ben found a blocker)

$BUILDSYS_ARCH is used all over the place in the Makefile, and if we don't
check that it's a valid supported architecture first, directories get created
and commands further down the line will fail.  This change checks
$BUILDSYS_ARCH first before anything happens and fails.

It doesn't use any parameter expansion like the previous check did, meaning it
will be compatible with all versions of bash.
When building AMIs, we need to canonicalize architectures to something that EC2
understands. This change uses an existing function to canonicalize the
architecture when running `pubsys ami`.
@zmrow
Copy link
Contributor Author

zmrow commented Oct 20, 2020

Fixes @bcressey 's concern - when we wrote the SSM publishing code we added a function to canonicalize architecture but hadn't gone back to add it to the AMI code.

@zmrow zmrow merged commit b4db4a9 into bottlerocket-os:develop Oct 21, 2020
@zmrow zmrow deleted the makefile-arch-check branch October 21, 2020 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants