Skip to content

Support multiple tags, formatted output and TTY progress in oras check #2361

Todo

Description

@TerryHowe

What is the version of your ORAS CLI

v1.4.0 / main (oras-go v3.0.0)

What would you like to be added?

Part of #1791. Depends on #2359, and the output should also cover the results added in #2360. This makes oras check easier to use in pipelines and interactively.

Scope

Three independent parts, each a separate PR, in this order:

  1. Formatted output: --format json and --format go-template.
  2. Multiple tags: oras check localhost:5000/hello:v1,v2,v3.
  3. TTY progress: byte progress for each node, in the style of oras cp.

Evaluation

Feasible after #2359. Effort is large as a whole: formatted output is small to medium, multiple tags and TTY progress are medium. Formatted output comes first because it fixes the result model that the other two use. Its schema should allow several artifacts from the start, so that multiple tags do not change it.

The parts are additive. The main risks are showing a failed or unfinished check as a success, and a schema that is hard to change later.

These behaviors were observed in scratch tests against oras-go v3.0.0 and the progress code on main:

Scenario Result What oras check needs to do
Intact layer shared by three tags, one VerifiedSet Fetched once, also when the tags ran in parallel Share the set; run tags in sequence, as VerifyGraph is already concurrent
Corrupt layer shared by three tags Fetched three times Remember failures
Same, remembering failures and returning SkipNode from PreVerify Fetched once, but report.OK() is true for the second and third tag Add the remembered failures to each tag's result; do not rely on OK()
oras.FailedNode as JSON The error becomes {} Use a model of our own
Node cancelled during a read PreVerify without PostVerify Do not rely on PostVerify to finish a tracker
Progress manager closed while a tracker is open Close hangs Close every tracker first
Tracker.Fail Shown with a red mark, also after the whole content was read, and after or before Done Use it; no new state is needed
Repository wrapped in a struct to track Fetch No longer a registry.ReferrerLister Wrap only for the walk; list referrers on the original target
Empty index Fetched twice in one walk Keep one tracker per descriptor

From reading the code: closing a tracker without calling Fail marks it as done, so a cancelled node would show a check mark. Render does not show the error text. The manager only draws the last rows that fit on the screen, so failures can scroll out of view.

Proposed implementation: formatted output

  1. Add a check model in metadata/model, with JSON, template and text handlers, and SetTypes as in pull.

  2. Suggested schema:

    {
      "ok": false,
      "complete": true,
      "artifacts": [
        {
          "reference": "localhost:5000/hello@sha256:...",
          "tags": ["v1"],
          "mediaType": "application/vnd.oci.image.manifest.v1+json",
          "digest": "sha256:...",
          "size": 1022,
          "ok": false,
          "verified": 3,
          "skipped": 0,
          "failures": [
            {
              "class": "corrupt",
              "message": "mismatched digest",
              "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip",
              "digest": "sha256:...",
              "size": 3638273
            }
          ],
          "warnings": []
        }
      ]
    }

    class is one of the four in Add oras check to verify the integrity of an artifact #2359: missing, corrupt, invalid, unable-to-check. Findings for a whole layout in Support referrers and whole OCI layouts in oras check #2360 have no descriptor, and need a separate list with a path.

  3. Render the report before returning the failure, so that standard output has the report and standard error has the error. pull only renders on success, so it is not a model for this.

  4. On cancellation, render what was checked with complete set to false. ok must be false whenever complete is false.

  5. Sort artifacts in the order requested and failures as in Add oras check to verify the integrity of an artifact #2359. Use empty lists instead of null.

Proposed implementation: multiple tags

  1. Split the reference on commas for a registry and for --oci-layout. Do not split it for --oci-layout-path, where the reference name is stored as is. Reject a digest in a list.
  2. Resolve every tag and record the ones that fail. resolveTags in backup.go stops at the first error, and parseArtifactReferences rejects digests and only handles registry references, so neither can be reused as is.
  3. Group tags that resolve to the same digest and check it once.
  4. Share one VerifiedSet for one storage. Never share it between storages.
  5. Remember missing, corrupt and invalid nodes by descriptor, and report them for every artifact that uses them. Do not remember nodes that could not be checked, because a later attempt may succeed.

Proposed implementation: TTY progress

  1. Add a tracked fetcher next to status/track.Target, which only tracks Push. Keep the original target for resolving and listing referrers.
  2. Start a tracker on the first fetch of a descriptor, and wrap the content with progress.TrackReader.
  3. Finish the tracker in PostVerify: Done if verification passed, otherwise Fail. A mismatch is only known after the whole content was read, so the reader cannot decide this. A node that fails before any content is read also needs a tracker.
  4. When the walk ends, call Fail and then Close on every open tracker before closing the manager.
  5. Print the summary with all failures after the progress display has stopped.

Design decisions to confirm

Tests

  • Unit, output: passing, failing and cancelled checks in text, JSON and template; each failure class; empty lists; report on standard output and error on standard error.
  • Unit, tags: shared layer that is intact, corrupt, missing or could not be checked, with fetch counts; tags with the same digest; one tag that does not resolve; digest in a list; comma in a --oci-layout-path reference.
  • Unit, progress: mismatch after a full read; failure before any read; cancellation does not hang or show a check mark; more nodes than rows; empty index; referrers still listed through the original target.
  • E2E: multiple tags; --format json with a non-zero exit code and valid JSON on standard output.

Related code

  • cmd/oras/root/pull.go, cmd/oras/internal/option/format.go: format options
  • cmd/oras/internal/display/handler.go; metadata/model, metadata/json, metadata/template: handler patterns
  • cmd/oras/root/backup.go: resolveTags, parseArtifactReferences
  • cmd/oras/internal/option/target.go: reference parsing
  • cmd/oras/internal/display/status/track: target.go, reader.go
  • cmd/oras/internal/display/status/progress: manager.go, messenger.go, status.go
  • internal/progress/tracker.go: Fail, Done, TrackReader
  • docs/proposals/formatted-output.md
  • oras-go v3.0.0: verify.go (VerifiedSet, PreVerify, PostVerify)

Why is this needed for ORAS?

Periodic pipelines that check the images in a production repository need results that scripts can read and should not download shared layers repeatedly. Interactive users need progress for large artifacts.

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

  • Yes, I am willing to implement it.

Activity

  1. added
    enhancement
    on Nov 25, 2026
  2. added this to the v1.5.0 milestone on Nov 25, 2026
  3. added
    help wanted
    and removed
    help wanted
    on Nov 25, 2026
  4. VanshajPoonia commented on Nov 29, 2026

    @VanshajPoonia
    Contributor

    I'd like to take part 1, the formatted output (--format json and --format go-template). Plan:

    • A check model in metadata/model with the proposed schema, and JSON, template and text handlers with SetTypes as in pull.
    • The report is rendered before the error, so standard output has the report and standard error has the error.
    • A cancelled check renders what was checked with complete and ok false.
    • Layout findings from feat(check): support checking a whole OCI layout #2372 go in their own list with a path.

    Parts 2 and 3 stay open for others, or I can follow with them once part 1 lands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementhelp wanted

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions