Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: support showing indirect referrers for all formats of oras discover #1653

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

wangxiaoxuan273
Copy link
Contributor

@wangxiaoxuan273 wangxiaoxuan273 commented Mar 12, 2025

What this PR does / why we need it:
This pull request:

  1. adds a --depth flag to oras discover command and it applies to all formats. It represents the depth of referrers to display. For example when depth is 1, the command shows only direct referrers; when depth is 2, it shows direct referrers and their referrers. Default is 20, which in practice usually shows all referrers of an image.
  2. introduces breaking changes to table and json formats, which previously was showing only the indirect referrers. Now all formats by default show all levels of referrers.

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

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?

@wangxiaoxuan273 wangxiaoxuan273 changed the title feat: support indirect referrers for all formats of oras discover feat!: support indirect referrers for all formats of oras discover Mar 12, 2025
Signed-off-by: Xiaoxuan Wang <[email protected]>
cmd.Flags().BoolVarP(&opts.verbose, "verbose", "v", false, "display full metadata of referrers")
cmd.Flags().IntVarP(&opts.depth, "depth", "", 20, "level of indirect referrers to display")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any ideas about a better default value than 20?

Copy link
Member

Choose a reason for hiding this comment

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

If the specified depth is less or equal than 0, it should be considered as infinity. And we can use 0 as the default value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we use 0 to represent infinity, we will need to do extra explanation to the users and it may cause confusion.

Signed-off-by: Xiaoxuan Wang <[email protected]>
@wangxiaoxuan273 wangxiaoxuan273 changed the title feat!: support indirect referrers for all formats of oras discover feat!: support showing indirect referrers for all formats of oras discover Mar 12, 2025
Signed-off-by: Xiaoxuan Wang <[email protected]>
Copy link

codecov bot commented Mar 12, 2025

Codecov Report

Attention: Patch coverage is 85.71429% with 6 lines in your changes missing coverage. Please review.

Project coverage is 84.56%. Comparing base (d971ec5) to head (94d1479).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...d/oras/internal/display/metadata/model/discover.go 85.71% 2 Missing and 1 partial ⚠️
cmd/oras/root/discover.go 75.00% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1653      +/-   ##
==========================================
+ Coverage   84.38%   84.56%   +0.18%     
==========================================
  Files         125      125              
  Lines        5661     5657       -4     
==========================================
+ Hits         4777     4784       +7     
+ Misses        629      621       -8     
+ Partials      255      252       -3     

☔ 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.

Xiaoxuan Wang added 4 commits March 12, 2025 14:30
Signed-off-by: Xiaoxuan Wang <[email protected]>
Signed-off-by: Xiaoxuan Wang <[email protected]>
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.

2 participants