-
Notifications
You must be signed in to change notification settings - Fork 54
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
Implement wit pull
#265
Implement wit pull
#265
Conversation
There is still much room for improvement but I think its useful enough as-is to iterate on. |
One open question is what to do with the |
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.
Seems like there's an issue with fetching direct dependencies that we should fix before merging, but overall this looks good.
I am getting errors when trying this out myself, presumably because I don't have access to the bytecodealliance.org
registry. I think we'll want to figure out the defaults around registries as well before merging.
The BA registry should be public, e.g. https://github.com/orgs/bytecodealliance/packages/container/package/warg%2Fwasi%2Fio |
This is the error I'm seeing when running the command against a wit world that uses a
|
crates/wit/src/commands/pull.rs
Outdated
if let Some(wit_version) = &version { | ||
let release_version = &release.version; | ||
if wit_version != release_version { | ||
terminal.warn(format!("Release version {release_version} doesn't match WIT package version {wit_version}"))?; |
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'm curious, when would this happen? What is the user supposed to do with this information?
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.
Currently nothing enforces that the outer registry version (Warg release version or OCI tag) matches the inner WIT package version. This is a problem here because we only have the WIT version for the "already installed" set and can only use the registry version to resolve packages to pull.
I'm not sure how to resolve this yet, so the warning serves primarily to alert publishers that something is wrong.
@@ -205,7 +205,6 @@ impl PullCommand { | |||
} | |||
} | |||
|
|||
#[derive(Debug)] | |||
struct PackagesState { | |||
// Packages currently present in the wit dir | |||
present: BTreeSet<PackageName>, |
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.
Nit: I'm not sure if present
is the best term here. Perhaps resolved
? 🤷♂️
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.
"Resolved" is kind of overloaded in this context. This was referred to as "existing" before but that seems even worse. 🤷
When I remove ghcr.io credentials by running
And if I log back in with So it seems we're not allowing anonymous access to the ghcr instance and we're not handling the error case of when the credentials are bad. I see you've opened lann/warg-loader#5 as well which should hopefully address this. |
I made 2 changes in warg-loader which should fix the above auth issues:
|
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.
Not sure how I'd test an expired token, but this seems to have fixed the issue when no token is present. I think this is ready to merge!
I tested by corrupting a token in |
If I'm understanding it correctly, this will not serve as a replacement for wit-deps? |
It might eventually. Part of the purpose of this tool is to be a proving ground for some of the more advanced import definition types now available in the component model which should be able to replace external dependency config files. See "options for naming imports" here: https://github.com/WebAssembly/component-model/blob/main/design/mvp/Explainer.md#import-and-export-definitions |
I believe this PR was closed by mistake by #270. I believe the correct issue to close was #268. @peterhuene can you reopen this PR? |
Whoops, sorry about that! |
Closing this PR. The |
This implements a
wit pull
subcommand which can be used to update local e.g.wit/deps/*.wit
from a registry.There are two modes of operation:
wit/deps/<namespace>-<name>@<version>.wit
wit/
for missing dependencies and attempt to pull them like aboveBoth of these can operate whether or not
wit_parser::Resolve::push_dir
can currently parse thewit/
directory. If it can parse, the existing dependency checks will just be more accurate (capturing e.g.wit/deps/some-package.wasm
). This ought to be more consistent but really needs some refactoring inwit-parser
first.