Skip to content

Support layer-level annotations via --annotation flag in oras push #2031

Description

@jmorla

What is the version of your ORAS CLI

1.3.0

What would you like to be added?

Extend --annotation to support an optional file prefix that binds the annotation to a specific layer descriptor, using a clearly documented syntax. For example:

# manifest-level (existing behavior)
--annotation "key=value"

# layer-level (proposed)
--annotation "filename.ex5:key=value"

Why is this needed for ORAS?

The --annotation flag only supports manifest-level annotations:

Flags:
  -a, --annotation stringArray                               manifest annotations

There is no inline CLI syntax to bind an annotation to a specific layer. The official docs show only this usage for manifest annotations:

oras push --annotation "key=val" localhost:5000/hello:v1

Layer-level annotations are exclusively supported via --annotation-file, which requires generating a temporary JSON file

Problem

In scripting and CI/CD scenarios where layer annotations need to be set dynamically per file, users are forced to generate, manage, and clean up temporary annotation files — just to bind a single annotation to a layer. This is cumbersome and error-prone, especially in batch push loops.
Additionally, the lack of a CLI-native syntax invites users to attempt --annotation ":=" intuitively, which silently produces incorrect results: instead of binding to the layer it dumps a literal key : into the manifest annotations, making it very hard to diagnose.

Are you willing to submit PRs to contribute to this feature?

  • Yes, I am willing to implement it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    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