Skip to content

Conversation

brooksmtownsend
Copy link
Member

Summary

  • Adds --annotation key=value parameter (repeatable) for custom OCI annotations
  • Includes convenience parameters for common OpenContainer standards (--description, --source, --url, --version, --licenses, --author)
  • Updates push command output to display component digest

Test plan

  • All existing tests pass (41/41)
  • 17 new unit tests added covering annotation parsing and manifest creation
  • Code formatted with cargo +nightly fmt
  • No clippy warnings
  • Manual testing with various annotation combinations

Closes #42

🤖 Generated with Claude Code

brooksmtownsend and others added 2 commits August 27, 2025 12:33
Signed-off-by: Brooks Townsend <[email protected]>
Add support for OCI manifest annotations when pushing WebAssembly components
to registries. This addresses GitHub issue wasmCloud#42 by implementing:

- `--annotation key=value` parameter for custom OCI annotations (repeatable)
- Convenience parameters for common OpenContainer annotations:
  - `--description` → org.opencontainers.image.description
  - `--source` → org.opencontainers.image.source
  - `--url` → org.opencontainers.image.url
  - `--version` → org.opencontainers.image.version
  - `--licenses` → org.opencontainers.image.licenses
  - `--author` → org.opencontainers.image.authors

- Modified push_component function to accept annotations parameter
- Custom OCI manifest creation with annotations when provided
- Enhanced CLI output to display component digest
- Comprehensive unit tests for annotation parsing and manifest generation
- Full validation of key=value format parsing with proper error handling

Examples:
  wash oci push registry.io/my/component:v1.0.0 component.wasm \
    --annotation "custom.key=value" \
    --description "My WebAssembly component" \
    --version "1.0.0"

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for OCI annotations to the push command, enabling users to attach metadata to pushed WebAssembly components through both custom annotations and convenience parameters for common OpenContainer standards.

  • Adds --annotation key=value parameter for custom OCI annotations and convenience flags for standard metadata
  • Updates the push_component function to accept optional annotations and create custom OCI manifests
  • Enhances push command output to display the component digest after successful operations

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.

File Description
crates/wash/src/oci.rs Adds annotation support to push_component function with manifest creation logic and comprehensive test coverage
crates/wash/src/cli/oci.rs Implements CLI annotation parsing, convenience parameters, and updated push command with enhanced output

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Member Author

@brooksmtownsend brooksmtownsend left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks largely good, but would be best to remove the many flags and just use annotations. Additionally, let's add in a section in the .wash/config.json for oci which supports listing annotations there and picking them up during the push process.

Copy link
Member Author

@brooksmtownsend brooksmtownsend left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks largely good, but would be best to remove the many flags and just use annotations. Additionally, let's add in a section in the .wash/config.json for oci which supports listing annotations there and picking them up during the push process.

brooksmtownsend and others added 2 commits August 27, 2025 13:44
- Remove convenience parameters (--description, --source, etc.) to keep only --annotation flag
- Add annotation_count to tracing instrument for better observability
- Simplify nested if conditions in manifest creation using filter/map pattern
- Only pass annotations when non-empty to avoid unnecessary processing
- Update tests to remove convenience parameter testing

Addresses feedback from wasmCloud#53

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Add OciConfig struct to wash configuration with annotations HashMap
- Integrate OciConfig into main Config struct with proper serialization
- Modify PushCommand to load annotations from config file
- CLI annotations override config annotations for same keys
- Add comprehensive tests for config serialization and loading
- Add documentation and examples for OCI configuration

Example config.json:
{
  "oci": {
    "annotations": {
      "org.opencontainers.image.source": "https://github.com/user/repo",
      "org.opencontainers.image.description": "My component"
    }
  }
}

Addresses feedback requesting config file support for OCI annotations

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[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.

[FEATURE] Add annotations as optional parameters to oci push
1 participant