Skip to content

Support OCI references in plugin test command #14

Description

@brooksmtownsend

Description

The wash plugin test command currently supports loading plugins from local filesystem paths (files or directories) but does not support OCI (Open Container Initiative) references. Adding OCI support would allow testing plugins directly from container registries.

Location

crates/wash/src/cli/plugin.rs:401 in the TestCommand::handle method

Current Behavior

The plugin test command loads WebAssembly components in two ways:

  1. Directory: Builds the component from source and reads the built artifact
  2. File: Reads the component directly from a local file path
let wasm = if self.plugin.is_dir() {
    // Build and read from directory
    tokio::fs::read(&built_path.artifact_path)
        .await
        .context("Failed to read built component file")?
} else {
    tokio::fs::read(&self.plugin)
        .await
        .context("Failed to read component file")?
    // TODO(GFI): support OCI references too
};

Proposed Solution

Add support for OCI references by:

  1. Detecting OCI references: Check if the plugin parameter is an OCI reference (starts with registry URL pattern)
  2. Fetching from registry: Use OCI client to download the component from the registry
  3. Caching: Consider caching downloaded components locally

Example Usage

After implementation, users should be able to run:

wash plugin test ghcr.io/wasmcloud/plugin-example:latest --hook pre_invoke

Context

This enhancement would improve the plugin development workflow by allowing developers to test plugins distributed via container registries without needing to download them manually first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions