Skip to content

Commit 22de80b

Browse files
feat!: Removes warg
This PR only focuses on removing warg with some basic updates to the documentation. Ideally we can change the config file as well, but I figured it would be good to start Signed-off-by: Taylor Thomas <[email protected]>
1 parent 7cdd8d7 commit 22de80b

File tree

19 files changed

+483
-2724
lines changed

19 files changed

+483
-2724
lines changed

Cargo.lock

Lines changed: 413 additions & 2145 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ anyhow = "1"
1313
base64 = "0.22"
1414
bytes = "1.8"
1515
docker_credential = "1.2.1"
16-
etcetera = "0.8"
16+
etcetera = "0.10"
1717
futures-util = "0.3.30"
1818
oci-client = { version = "0.14", default-features = false, features = [
1919
"rustls-tls",
@@ -27,7 +27,7 @@ serde_json = "1"
2727
sha2 = "0.10"
2828
tempfile = "3.10.1"
2929
testcontainers = { version = "0.23" }
30-
thiserror = "1.0"
30+
thiserror = "2.0"
3131
tokio = "1.35.1"
3232
tokio-util = "0.7.10"
3333
toml = "0.8"
@@ -39,6 +39,6 @@ tracing-subscriber = { version = "0.3.18", default-features = false, features =
3939
wasm-pkg-common = { version = "0.10.0", path = "crates/wasm-pkg-common" }
4040
wasm-pkg-client = { version = "0.10.0", path = "crates/wasm-pkg-client" }
4141
wasm-pkg-core = { version = "0.10.0", path = "crates/wasm-pkg-core" }
42-
wasm-metadata = "0.224"
43-
wit-component = "0.224"
44-
wit-parser = "0.224"
42+
wasm-metadata = "0.226"
43+
wit-component = "0.226"
44+
wit-parser = "0.226"

README.md

Lines changed: 10 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
Tools to package up [Wasm Components](https://github.com/webassembly/component-model)
88

99
This repo contains several Rust crates that can be used for fetching and publishing Wasm Components
10-
to OCI or Warg registries. It is also the home of the `wkg` command line tool, which exposes all the
10+
to OCI registries. It is also the home of the `wkg` command line tool, which exposes all the
1111
functionality of the libraries. The first (but not only) focus of this project is allow for fetching
1212
of Wit Interfaces stored as components for use in creating components. It can also be used to fetch
1313
and publish component "libraries" to/from a registry.
@@ -94,24 +94,9 @@ another = { registry = "another", metadata = { preferredProtocol = "oci", "oci"
9494
# Same as namespace_registries above, but for a specific package.
9595
"example:bar" = { registry = "another", metadata = { preferredProtocol = "oci", "oci" = {registry = "ghcr.io", namespacePrefix = "webassembly/" } } }
9696

97-
# This section contains a mapping of registries to their configuration. There are currently 3
98-
# supported types of registries: "oci", "warg", and "local". The "oci" type is the default. The
99-
# example below shows a use case that isn't yet super common (registries that speak multiple protocols)
100-
# but is included for completeness.
97+
# This section contains a mapping of registries to their configuration. There are currently 2
98+
# supported types of registries: "oci" and "local". The "oci" type is the default.
10199
[registry."acme.registry.com"]
102-
# This field is only required if more that one protocol is supported. It indicates which protocol
103-
# to use by default. If this is not set, then the fallback (oci) will be used.
104-
default = "warg"
105-
[registry."acme.registry.com".warg]
106-
# A path to a valid warg config file. If this is not set, the `wkg` CLI (but not the libraries)
107-
# will attempt to load the config from the default location(s).
108-
config_file = "/a/path"
109-
# An optional authentication token to use when authenticating with a registry.
110-
auth_token = "an-auth-token"
111-
# An optional key for signing the component. Ideally, you should just let warg use the keychain
112-
# or programmatically set this key in the config without writing to disk. This offers an escape
113-
# hatch for when you need to use a key that isn't in the keychain.
114-
signing_key = "ecdsa-p256:2CV1EpLaSYEn4In4OAEDAj5O4Hzu8AFAxgHXuG310Ew="
115100
[registry."acme.registry.com".oci]
116101
# The auth field can either be a username/password pair, or a base64 encoded `username:password`
117102
# string. If no auth is set, the `wkg` CLI (but not the libraries) will also attempt to load the
@@ -131,11 +116,11 @@ root = "/a/path"
131116
# If a registry only has a config section for one protocol, then that protocol is automatically
132117
# the default. The following is equivalent to:
133118
# [registry."example.com"]
134-
# default = "warg"
135-
# [registry."example.com".warg]
136-
# config_file = "/a/path"
137-
[registry."example.com".warg]
138-
config_file = "/a/path"
119+
# default = "oci"
120+
# [registry."example.com".oci]
121+
# auth = { username = "open", password = "sesame" }
122+
[registry."example.com".oci]
123+
auth = { username = "open", password = "sesame" }
139124

140125
# Configuration for the "another" registry defined above.
141126
[registry."another".oci]
@@ -155,24 +140,19 @@ A full example of what this `registry.json` file should look like is below:
155140

156141
```json
157142
{
158-
"preferredProtocol":"warg",
159-
"warg": {"url":"https://warg.example.com"},
143+
"preferredProtocol":"oci",
160144
"oci": {"registry": "ghcr.io", "namespacePrefix": "webassembly/"}
161145
}
162146
```
163147

164148
The `preferredProtocol` field is optional and specifies which protocol the registry expects you to
165-
use in the case where it supports both OCI and Warg. If both `warg` and `oci` config is in the
166-
`registry.json` it is _highly recommended_ that this field be set.
149+
use. While this field is present for future compatibility, it's generally fixed to "oci" in this implementation.
167150

168151
For the `oci` config, the `registry` field is the base URL of the OCI registry, and the
169152
`namespacePrefix` field is the prefix that is used to store components in the registry. So in the
170153
example above (which is for wasi.dev), the components will be available at
171154
`ghcr.io/webassembly/$NAMESPACE/$PACKAGE:$VERSION` (e.g. `ghcr.io/webassembly/wasi/http:0.2.1`).
172155

173-
For the `warg` config, the `url` field is the base URL of the Warg registry used when connecting the
174-
client. Namespacing for warg is built in to the protocol.
175-
176156
Please note that for backwards compatibility, with previous tooling and versions of the `wkg` tool,
177157
you may also encounter a `registry.json` file that looks different. These files are still supported,
178158
but should be considered deprecated.
@@ -186,16 +166,6 @@ For OCI registries, the JSON looks like this:
186166
}
187167
```
188168

189-
190-
191-
For Warg registries, the JSON looks like this:
192-
193-
```json
194-
{
195-
"wargUrl": "https://warg.wa.dev"
196-
}
197-
```
198-
199169
### Conventions for storing components in OCI
200170

201171
Astute observers will note that OCI requires a specific structure for how those components are

crates/wasm-pkg-client/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@ toml = { workspace = true }
3434
tracing = { workspace = true }
3535
tracing-subscriber = { workspace = true }
3636
url = "2.5.0"
37-
warg-client = "0.9.2"
38-
warg-crypto = "0.9.2"
3937
wasm-metadata = { workspace = true }
40-
warg-protocol = "0.9.2"
4138
wasm-pkg-common = { workspace = true, features = ["metadata-client", "tokio"] }
4239
wit-component = { workspace = true }
4340

crates/wasm-pkg-client/src/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ pub mod local;
3232
pub mod oci;
3333
mod publisher;
3434
mod release;
35-
pub mod warg;
3635

3736
use std::path::Path;
3837
use std::sync::Arc;
@@ -55,7 +54,7 @@ pub use wasm_pkg_common::{
5554
};
5655
use wit_component::DecodedWasm;
5756

58-
use crate::{loader::PackageLoader, local::LocalBackend, oci::OciBackend, warg::WargBackend};
57+
use crate::{loader::PackageLoader, local::LocalBackend, oci::OciBackend};
5958

6059
pub use release::{Release, VersionInfo};
6160

@@ -276,9 +275,6 @@ impl Client {
276275
&registry_config,
277276
&registry_meta,
278277
)?),
279-
"warg" => {
280-
Box::new(WargBackend::new(&registry, &registry_config, &registry_meta).await?)
281-
}
282278
other => {
283279
return Err(Error::InvalidConfig(anyhow!(
284280
"unknown backend type {other:?}"

crates/wasm-pkg-client/src/oci/loader.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
use async_trait::async_trait;
22
use futures_util::{StreamExt, TryStreamExt};
33
use oci_client::{manifest::OciDescriptor, RegistryOperation};
4-
use warg_protocol::Version;
5-
use wasm_pkg_common::{package::PackageRef, Error};
4+
use wasm_pkg_common::{
5+
package::{PackageRef, Version},
6+
Error,
7+
};
68

79
use crate::{
810
loader::PackageLoader,
@@ -36,7 +38,12 @@ impl PackageLoader for OciBackend {
3638
yanked: false,
3739
}),
3840
Err(err) => {
39-
tracing::warn!(?tag, error = ?err, "Ignoring invalid version tag");
41+
// Signature tags all start with a SHA and shouldn't generate a warning
42+
if tag.starts_with("sha256-") {
43+
tracing::debug!(?tag, "Ignoring signature tag");
44+
} else {
45+
tracing::warn!(?tag, error = ?err, "Ignoring invalid version tag");
46+
}
4047
None
4148
}
4249
})

crates/wasm-pkg-client/src/oci/publisher.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl PackagePublisher for OciBackend {
5555
homepage.to_string(),
5656
);
5757
}
58-
if let Some(authors) = &meta.author {
58+
if let Some(authors) = &meta.authors {
5959
annotations.insert(
6060
"org.opencontainers.image.authors".to_string(),
6161
authors.to_string(),

0 commit comments

Comments
 (0)