Stream: cargo-component

Topic: cargo component new using a direct world reference from OCI


view this post on Zulip Ralph (Sep 09 2024 at 10:23):

Hey cats, I'm noting that we have cargo component new options as follows:

view this post on Zulip Ralph (Sep 09 2024 at 10:24):

view this post on Zulip Ralph (Sep 09 2024 at 10:27):

If I wanted to build a wasi:http/proxy component by targeting the "proxy" world in ghcr.io/webassembly/wasi/http:0.2.0 what magic mix of strings would I use to create an instantly building version (absent the lib.rs code that implements it)?

List of Rust libraries and applications. An unofficial experimental opinionated alternative to crates.io

view this post on Zulip Ralph (Sep 09 2024 at 10:27):

I recall from a previous thread that this didn't work yet, and I'm hoping it does now. But if it doesn't, that's OK!!!

view this post on Zulip Taylor Thomas (Sep 09 2024 at 17:04):

By default, the new underlying client stuff will default to the bytecodealliance registry, which is just a mirror of the webassembly one (trying to fix an issue so it points at wasi.dev, which redirects to ghcr.io/webassembly). So you don't need to specify a registry. In general, if you want to point to any custom registries, I'd recommend setting it as part of the wkg config so all tooling can use it. Documentation for that config file can be found here: https://github.com/bytecodealliance/wasm-pkg-tools#configuration

The WebAssembly System Interface (WASI) is a group of standard API specifications for software compiled to the W3C WebAssembly (Wasm) standard. WASI is designed to provide a secure standard interface for applications that can be compiled to Wasm from any language, and that may run anywhere—from browsers to clouds to embedded devices.
Contribute to bytecodealliance/wasm-pkg-tools development by creating an account on GitHub.

view this post on Zulip Ralph (Sep 09 2024 at 17:05):

are the magic strings the same for both paths? command line and config?

view this post on Zulip Taylor Thomas (Sep 09 2024 at 17:06):

You don't need to set any strings in the case you're describing.

view this post on Zulip Ralph (Sep 09 2024 at 17:20):

let me rephrase: if I want to use command line args to point at a specific registry, are the magic strings used identical to those in the config docs?

view this post on Zulip Ralph (Sep 09 2024 at 17:20):

caveat escaping, of course....

view this post on Zulip Ralph (Sep 09 2024 at 17:22):

[registry."acme.registry.com".oci]

view this post on Zulip Taylor Thomas (Sep 09 2024 at 17:23):

Yeah, generally the registry is just something like myreg.registry.io that maps to the name of registry config. Yep, what you put exactly

view this post on Zulip Taylor Thomas (Sep 09 2024 at 17:23):

If it doesn't need auth, you don't even need that

view this post on Zulip Ralph (Sep 09 2024 at 17:23):

ignoring the .oci or .warg part?

view this post on Zulip Ralph (Sep 09 2024 at 17:23):

I'll try it all out tomorrow morning, so no biggie, just wanna understand where it is.

view this post on Zulip Ralph (Sep 09 2024 at 17:23):

I love the config file, BTW

view this post on Zulip Taylor Thomas (Sep 09 2024 at 17:25):

So let's say you have a registry with the prefix of acme, then the minimum you'd need for the config is an entry under namespace_registries:

[namespace_registries]
acme = "acme.registries.io"

If you need auth then you'd specify the section you mentioned above

view this post on Zulip Lann Martin (Sep 09 2024 at 17:25):

Note that it isn't just a magic string. The default registry config (which can be overridden by the config file) will be fetched from https://<registry>/.well-known/wasm-pkg/registry.json

view this post on Zulip Ralph (Sep 09 2024 at 17:25):

got it; read the comments incorrectly, thanks!

view this post on Zulip Lann Martin (Sep 09 2024 at 17:25):

e.g. https://bytecodealliance.org/.well-known/wasm-pkg/registry.json

view this post on Zulip Taylor Thomas (Sep 09 2024 at 17:26):

Specification for that is found here: https://github.com/bytecodealliance/wasm-pkg-tools#well-known-metadata

Contribute to bytecodealliance/wasm-pkg-tools development by creating an account on GitHub.

view this post on Zulip Ralph (Sep 09 2024 at 17:26):

Lann Martin said:

Note that it isn't just a magic string. The default registry config (which can be overridden by the config file) will be fetched from https://<registry>/.well-known/wasm-pkg/registry.json

forgive me, by "magic string" i merely mean that "arbitrary but decided form that will actually work but isn't explicitly mentioned anywhere but the code"

view this post on Zulip Ralph (Sep 09 2024 at 17:26):

:-)

view this post on Zulip Ralph (Sep 09 2024 at 17:26):

that it is IN the code, I get

view this post on Zulip Taylor Thomas (Sep 09 2024 at 17:26):

I tried to document as best as I could, but I definitely have been staring at it too long and could have missed something obvious. So let me know if anything there is confusing

view this post on Zulip Lann Martin (Sep 09 2024 at 17:27):

Yeah just want to clarify that you shouldn't use some arbitrary string, and in particular you definitely shouldn't use competitor.com :smile:

view this post on Zulip Ralph (Sep 09 2024 at 17:27):

Taylor Thomas said:

I tried to document as best as I could, but I definitely have been staring at it too long and could have missed something obvious. So let me know if anything there is confusing

nol no, it's there -- just comments sitting on top of code values after a few graphs get hard to parse. I'll submit a pr that breaks it up a bit, but I do love the config approach.

view this post on Zulip Ralph (Sep 09 2024 at 17:27):

Lann Martin said:

Yeah just want to clarify that you shouldn't use some arbitrary string, and in particular you definitely shouldn't use competitor.com :smile:

note to self: definitely using competitor.com

imcompetitor2023-09-06T14:15:00+00:00September 6th, 2023|

view this post on Zulip Ralph (Sep 11 2024 at 17:24):

new wkg is the bomb. Just wanna say, pushing and pulling to ACR using full auth is working great.

view this post on Zulip Ralph (Sep 11 2024 at 17:25):

thank you everyone; I hope to tout the work more!!! HT: @Taylor Thomas for taking a moment yesterday


Last updated: Nov 25 2024 at 19:03 UTC