Skip to content

Conversation

@vados-cosmonic
Copy link

@vados-cosmonic vados-cosmonic commented May 13, 2025

This commit adds support for using custom registries with targets when performing cargo component new. Users can specify a registry URI like oci://ghcr.io along with a registry namespace prefix like bytecodealliance and get easy access to packages (e.g. docs:adder) that are provided therein.

NOTE This PR relies on a related one in wasm-pkg-tools
Until that PR is merged, the Cargo.toml in use here can't be updated to remove the pointer to my fork.

An example invocation:

cargo component new \
    --lib \
    --target docs:adder \
    --registry oci://ghcr.io \
    --registry-ns-prefix bytecodealliance \
    adder

While this invocation seems long, it is much shorter than configuring other tooling, and serves as a decent option for quickstarts IMO.

The one thing left to solve in this issue is how to enable cargo component to pull from namespace registry overrides from via it's own config (or alternatively, create a wkg.toml )

@vados-cosmonic vados-cosmonic marked this pull request as draft May 13, 2025 12:41
@vados-cosmonic
Copy link
Author

It looks like adding wkg.toml into the created repository (i.e. adding the file to the output of cargo component new) is the most reasonable way forward, and just works with the upstream projects involved with minimal strain on the user's side.

Given that currently wkg.toml only currently supports file path based overrides, I think the most reasonable path forward here is to add support there for namespace package overrides.

@vados-cosmonic vados-cosmonic marked this pull request as ready for review May 16, 2025 04:02
@vados-cosmonic
Copy link
Author

vados-cosmonic commented May 16, 2025

@macovedj @calvinrp not sure if we need an upstream release of wasm-pkg-tools here, but at the very least the new functionality is in upstream there!

[EDIT] this bit is still a bit thorny:

The one thing left to solve in this issue is how to enable cargo component to pull from namespace registry overrides from via it's own config (or alternatively, create a wkg.toml )

Going to put this back into draft for now... Adding namespace registry overrides to wkg.toml needs to land.

@vados-cosmonic vados-cosmonic marked this pull request as draft May 16, 2025 05:18
This commit adds support for using custom registries with targets when
performing `cargo component new`. Users can specify a registry URI
like `oci://ghcr.io` along with a registry namespace prefix like
`bytecodealliance` and get easy access to packages (e.g. `docs:adder`)
that are provided therein.

Signed-off-by: Victor Adossi <[email protected]>
@vados-cosmonic vados-cosmonic force-pushed the feat=use-registry-for-cargo-component-new branch from aa4d36e to 5f6ebae Compare June 23, 2025 14:13
Signed-off-by: Victor Adossi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant