Repository navigation
feat(check): support checking a whole OCI layout - #2372
Merged
Merged
Conversation
Allow oras check to verify an entire OCI image layout directory or tar archive when invoked without a tag or digest reference via --oci-layout or --oci-layout-path. Signed-off-by: lyn1dev <[email protected]>
lyn1dev
requested review from
TerryHowe,
Wwwsylvia,
sabre1041,
sajayantony and
shizhMSFT
as code owners
November 25, 2026 22:52
TerryHowe
reviewed
Nov 25, 2026
Signed-off-by: lyn1dev <[email protected]>
TerryHowe
reviewed
Nov 26, 2026
TerryHowe
reviewed
Nov 27, 2026
Apply review suggestions: unreferenced blobs no longer inflate the "Checked N nodes" count, so directory and tar layouts report the same number, and a single layout problem is reported as "1 layout problem". Signed-off-by: Terry Howe <[email protected]>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2372 +/- ##
==========================================
- Coverage 90.71% 90.53% -0.18%
==========================================
Files 157 158 +1
Lines 6967 7473 +506
==========================================
+ Hits 6320 6766 +446
- Misses 376 416 +40
- Partials 271 291 +20 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
1 task
This was referenced Nov 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
Adds whole OCI image layout checking to
oras checkwhen invoked on a layout directory or tar archive without a tag or digest reference:oras check --oci-layout <path>oras check --oci-layout-path <path>This is the first of two separate PRs for #2360 (whole OCI layout checking;
--include-referrersis left for a follow-up PR).Summary of changes
cmd/oras/root/check.go,cmd/oras/internal/argument/checker.go):argument.AtMost(1)so--oci-layout-path <path>accepts zero positional arguments while still rejecting extra arguments.--oci-layout <path>or--oci-layout-path <path>) to whole-layout checking, while keeping trailing empty references (--oci-layout <path>:) and tagless registry references returning"no tag or digest specified".--platformwhen checking a whole layout.oci.Verifyon the layout directory to validateoci-layout,index.json, every blob inblobs/, interrupted-write leftovers, stray files / unsupported algorithms, and reachability.oras.VerifiedSetwith each verified blob's digest and actual on-disk size, then runsoras.VerifyGraphover all manifests listed inindex.jsonso manifest shapes, descriptor sizes, and cross-manifest references are validated without re-reading intact leaf blobs.Not checkedand absent subjects not listed inindex.jsonasWarning, while failing when a missing manifest is listed inindex.json), deduplicates findings acrossoci.Verifyand graph walks, and reports leftovers and unreferenced blobs as informationalNote:lines.oci.NewStorageFromTar, walks all manifests inindex.jsonwith a sharedoras.VerifiedSet, and printsNot checked: unreferenced blobs and stray files are not checked in a tar archive.cmd/oras/root/check_test.goandcmd/oras/internal/argument/checker_test.gocovering directory and tar layouts, wrong descriptor sizes, mistyped manifests, corrupt/missingindex.jsonandoci-layout,ingest/leftovers, absent foreign layers, corrupt/missing referrers vs. absent subjects, unreferenced blobs, stray/unsupported blob files,VerifiedSetread-skipping, cancellation, and CLI flags.test/e2e/suite/command/check.gofor tagless registry checks and added whole-layout andoras backupdirectory/tar E2E cases.Verification
go test -race ./cmd/oras/internal/argument ./cmd/oras/rootpassed.go test -c ./suite/commandandgo vet ./...intest/e2esucceeded.golangci-lint run --new-from-rev=HEADreported 0 issues on the modified packages.Which issue(s) this PR fixes:
Part of #2360
Please check the following list:
oras checkleaves experimental or alongside command reference updates)