-
Notifications
You must be signed in to change notification settings - Fork 97
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
Add ability to generate new artifact type #631
Conversation
a26fc4b
to
5f33d07
Compare
9836cd1
to
3085cc0
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.
Great work! Added some refactoring suggestions
pub trait OciConfig { | ||
fn os(&self) -> String; | ||
fn architecture(&self) -> String; | ||
fn layers(&self) -> Vec<String>; | ||
fn to_string(&self) -> String; | ||
} |
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.
suggestion:
pub trait OciConfig { | |
fn os(&self) -> String; | |
fn architecture(&self) -> String; | |
fn layers(&self) -> Vec<String>; | |
fn to_string(&self) -> String; | |
} | |
pub trait OciConfig { | |
fn os(&self) -> &str; | |
fn architecture(&self) -> &str; | |
fn layers(&self) -> &[String]; | |
} | |
impl<T: OciConfig> ToString for T { | |
fn to_string(&self) -> String { | |
serde_json::to_string_pretty(self).unwrap() | |
} | |
} |
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 tried this out but I get various errors like:
define and implement a trait or new type insteadrustc[Click for full compiler diagnostic](rust-analyzer-diagnostics-view:/diagnostic%20message%20%5B0%5D?0#file%3A%2F%2F%2Fhome%2Fjstur%2Fprojects%2Frunwasi%2Fcrates%2Foci-tar-builder%2Fsrc%2Flib.rs)
lib.rs(43, 19): `WasmConfig` is not defined in the current crate
| impl<T: OciConfig> ToString for T {
| ^ type parameter `T` must be used as the type parameter for some local type
I think this is again an issue with the fact that I am extending types outside of the current crate
impl Default for Builder<ImageConfiguration> { | ||
fn default() -> Self { | ||
Self { | ||
configs: Vec::new(), | ||
layers: Vec::new(), | ||
} | ||
} | ||
} |
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: remove as the above suggestion derives Default
trait
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 tried this suggestion but default marcro doesn't work since we have two different types, one of which doesn't have a default implementation
4d109d5
to
40a6d0c
Compare
I published an example to https://github.com/users/jsturtevant/packages/container/package/wasi-artifact Can use the new tooling
|
I am not sure why the smoke test is failing, I've run the same tests locally and it doesn't timeout. I've also not modified any the shim or the test image. |
it is also only failing on ubuntu 20.04 |
Signed-off-by: James Sturtevant <[email protected]>
40a6d0c
to
133142c
Compare
The musl build of wasmtime and the image built with these changes is working on ubuntu 20.04 for me locally |
/assign @devigned |
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.
lgtm! Great work, @jsturtevant!
Address concerns and Joe is away from keyboard right now
The CNCF wg-wasm has published an OCI artifact format for packaging wasm modules and components. The artifact can be produced locally by running the
--as-artifact
flag:Note: this does not add support to runwasi to run these yet. Some work in Containerd is required: containerd/containerd#10179