-
Notifications
You must be signed in to change notification settings - Fork 239
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
Refactor UpCommand #1236
Refactor UpCommand #1236
Conversation
c0fb7fa
to
76e0008
Compare
aa855cb
to
60eab3c
Compare
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.
The refactoring looks great - love getting that knot of application origins untangled and getting a unified path for figuring out the trigger args.
The request changes is for an integration test change that seems unrelated to all this, but appears to be removing a desired check that we've had regressions on in the past. But I may be misunderstanding the change!
tests/integration.rs
Outdated
@@ -983,7 +986,7 @@ trigger = { type = "http", base = "/" } | |||
version = "0.1.0" | |||
[[component]] | |||
id = "unbuilt" | |||
source = "DOES-NOT-EXIST.wasm" | |||
source = "spin.toml" # dirty trick |
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 appears to be changing the test - the test is meant to assert that help works even when the app has not been build (i.e. source
failed to resolve at all). I.e. that spin new > spin up --help
works correctly. This seems (if I'm reading it right) to be using a file that exists but isn't valid Wasm, which isn't what this test wants to prove What am I missing?
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.
Ah, I didn't realize this was testing that intentionally; indeed this is a regression for that situation. The basic problem is that deep in spin_trigger::locked::build_locked_app
we call canonicalize
on all our paths, which requires those paths to exist. Maybe I can resolve that problem...
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.
Yes, I think that was something Brian hit when trying to unify around the locked app, and is (at least part of) why the local-vs-remote code paths came to diverge.
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.
OK it looks like that canonicalize
just wasn't (ever?) necessary; Application
paths appear to come pre-absolutize
d.
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.
Certainly the local loader tries to absolutise paths as early as possible.
One of these days I want AbsolutePath
and RelativePath
types so we can document this behaviour at the type level and actually enforce that it remains true...
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.
I was just testing this with a malformed spin.toml
that is an http
trigger, not sure if this has been resolved just yet but i see the following notably missing the trigger options:
❯ spin up -f examples/http-rust -h
spin-up
Start the Spin application
USAGE:
spin up [OPTIONS]
OPTIONS:
--direct-mounts For local apps with directory mounts and no excluded files, mount
them directly instead of using a temporary directory
-e, --env <ENV> Pass an environment variable (key=value) to all components of the
application
-f, --from <APPLICATION> The application to run. This may be a manifest (spin.toml) file, a
directory containing a spin.toml file, or a remote registry
reference. If omitted, it defaults to "spin.toml"
-h, --help
-k, --insecure Ignore server certificate errors from bindle server or registry
--temp <TMP> Temporary directory for the static assets of the components
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.
Ugh, good catch. I bet an actually malformed spin.toml
is a whole new failure mode. Guessing it gets past the "no app so show default trigger options" stage, but then can't deserialise the file to work out the trigger and so gives up rather than calling to help-only trigger. It's an existing problem though, not an issue with this PR; I'd do it as a separate issue.
Signed-off-by: Lann Martin <lann.martin@fermyon.com>
60eab3c
to
a499aa4
Compare
a499aa4
to
abf5bfa
Compare
Signed-off-by: Lann Martin <lann.martin@fermyon.com>
Signed-off-by: Lann Martin <lann.martin@fermyon.com>
The child process output was only being printed on process failure, not later test assertions. Printing the output unconditionally allows it to be seen on any failure without noisy --nocapture. Signed-off-by: Lann Martin <lann.martin@fermyon.com>
abf5bfa
to
1decdd2
Compare
The most complex refactoring is easier to read in just the second commit: 3073adb