-
Notifications
You must be signed in to change notification settings - Fork 61
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
Remove user environment validation logic #785
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Integralist
force-pushed
the
integralist/strip-env-validation
branch
from
February 1, 2023 14:59
17410d7
to
b3a6fef
Compare
kailan
approved these changes
Feb 2, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fantastic! Really pleased to see so much code removed. Great work
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context:
The
compute build
command currently contains internal logic for validating a user's local environment. It does this in an attempt to reduce the number of possible errors when trying to compile a Compute project.Problem:
The validation logic is tightly coupled to specific expectations of the CLI and its starter kits and consequently results in errors that are difficult to understand and debug, as well as restricts users from using their own tools and scripts.
Solution:
We should remove as much of the user environment validation logic as possible as this will help to reduce friction for users who want to switch the tooling used, as well as reduce the general confusion caused for users when there are environment validation errors, and lastly, it reduces the maintenance overhead for contributors to the CLI code base as the logic flow becomes much simpler.
Notes:
In the
5.x
CLI releases we persisted a 'default' build script to disk (specifically thefastly.toml
manifest). We no longer do that as part of the changes in this PR. The intention for the new6.0.0
CLI release is to use the default build script and inform the user but not to persist that to disk under the[scripts.build]
section. This makes the developer experience less confusing for users (e.g. you no longer open up your fastly.toml manifest and find a bunch of things have been unexpectedly added/modified).Screenshots:
Below are some screenshots to highlight the new output using the compute-starter-kit-rust-default.
First, we initialise a new project, we take a look at the
fastly.toml
manifest and see there is no[scripts.build]
defined, and we runcompute build
(the CLI will use a 'default' build script known to work generally for Rust):If we re-run the command with
--verbose
we'll see additional information that lets us know what the CLI is doing:If we had instead manually updated the
fastly.toml
manifest to include a[scripts.build]
that failed to produce the expected output (we state in our documentation that we require the build script to produce a./bin/main.wasm
binary), then we would see this error returned, which includes some generic steps to help guide the user:The first bullet point suggestion says to re-run the command with the
--verbose
flag, and if we do that we'll see the following output (admittedly in my contrived example it doesn't really offer any more help but if your[scripts.build]
was an actual script trying to produce a./bin/main.wasm
binary, then the output from that command would be displayed and hopefully there would be enough context in its error output to guide the user):