Skip to content

Conversation

wangxiaoxuan273
Copy link
Contributor

@wangxiaoxuan273 wangxiaoxuan273 commented Aug 8, 2025

What this PR does / why we need it:

PoC implementation: #1801
Issue: #1791

What will be checked by oras check:

For each image specified by the user (by name or digest), we will check:

[for the manifest]

If the manifest referenced by the tag or digest exists in the repository.
If the manifest's size, digest and media type match the information saved on the repo server. (technically, that means if the descriptor resolved by the repo server matches the actual manifest)

[for each blob, including config and layers]

If the blob referenced by the manifest exists in the repository.
If the blob's size and digest match the descriptors in the manifest

[check the subject if present, recursively]

check the subject's manifest as mentioned above
check the subject's layer as mentioned above

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Please check the following list:

  • Does the affected code have corresponding tests, e.g. unit test, E2E test?
  • Does this change require a documentation update?
  • Does this introduce breaking changes that would require an announcement or bumping the major version?
  • Do all new files have an appropriate license header?

Signed-off-by: Xiaoxuan Wang <[email protected]>
Copy link

codecov bot commented Aug 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.27%. Comparing base (8ed63f6) to head (a261341).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1803      +/-   ##
==========================================
+ Coverage   85.25%   85.27%   +0.02%     
==========================================
  Files         143      143              
  Lines        6739     6739              
==========================================
+ Hits         5745     5747       +2     
+ Misses        706      704       -2     
  Partials      288      288              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Xiaoxuan Wang <[email protected]>
@wangxiaoxuan273 wangxiaoxuan273 marked this pull request as ready for review August 11, 2025 09:40
@wangxiaoxuan273 wangxiaoxuan273 marked this pull request as draft August 11, 2025 10:47
@wangxiaoxuan273 wangxiaoxuan273 changed the title [wip] oras check design oras check draft design Aug 11, 2025
@@ -0,0 +1,114 @@
# oras check draft design

This is a draft design for the `oras check` command.
Copy link
Member

@FeynmanZhou FeynmanZhou Aug 14, 2025

Choose a reason for hiding this comment

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

Could you clarify what content will be checked? Linking to this issue #1791 can also provide some context to reviewers

Copy link
Contributor Author

@wangxiaoxuan273 wangxiaoxuan273 Aug 14, 2025

Choose a reason for hiding this comment

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

For each image specified by the user (by name or digest), we will check:

[for the manifest]

  1. If the manifest referenced by the tag or digest exists in the repository.
  2. If the manifest's size, digest and media type match the information saved on the repo server. (technically, that means if the descriptor resolved by the repo server matches the actual manifest)

[for each blob, including config and layers]

  1. If the blob referenced by the manifest exists in the repository.
  2. If the blob's size and digest match the descriptors in the manifest

[check the subject if present, recursively]

  1. check the subject's manifest as mentioned above
  2. check the subject's blobs as mentioned above

Copy link
Member

Choose a reason for hiding this comment

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

Maybe just add this text here?

## Questions for discussion
1. Should we support reference by digest?
2. Should we support validating index? What should the behavior be?
3. Should we support validating an entire repository? (`oras check localhost:5000/hello`, no image reference is given) No newline at end of file
Copy link
Member

@FeynmanZhou FeynmanZhou Aug 14, 2025

Choose a reason for hiding this comment

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

We may want to think which use case that users want to check the entire repo? My assumption is that users may want to check the content completeness and integrity when backup or restore an entire repo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Two scenarios I can think of:

  1. When a user fails to pull an image from the registry, he can run oras check to see if the image is corrupted. This helps the user to troubleshoot faster.
  2. User may want to set up a periodic pipeline (say once a month) to check that all current images in the production repository are intact.


## Questions for discussion
1. Should we support reference by digest?
2. Should we support validating index? What should the behavior be?
Copy link
Member

Choose a reason for hiding this comment

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

I think an image index should be considered as it will saves some time for users to check a multi-platform image; otherwise, users have to manually retrieve digest of each multi-platform image and check them one by one.

The behavior would be checking the content integrity of each platform-specific manifest.

https://github.com/oras-project/oras/pull/1801

## Questions for discussion
1. Should we support reference by digest?
Copy link
Member

Choose a reason for hiding this comment

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

Can you clarify this question?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What I mean is, currently we support
oras check localhost:5000/repo:v1

Do we want to support
oras check localhost:5000/repo@sha256:xxxxx ?

Xiaoxuan Wang added 2 commits August 19, 2025 16:59
Signed-off-by: Xiaoxuan Wang <[email protected]>
Signed-off-by: Xiaoxuan Wang <[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.

3 participants