oras-project / oras

OCI registry client - managing content like artifacts, images, packages
https://oras.land
Apache License 2.0
1.52k stars 181 forks source link

feat: support oras discover pass pagination args #1525

Open njucjc opened 3 weeks ago

njucjc commented 3 weeks ago

What this PR does / why we need it: support oras discover pass pagination args

Please check the following list:

codecov[bot] commented 3 weeks ago

Codecov Report

Attention: Patch coverage is 42.85714% with 4 lines in your changes missing coverage. Please review.

Project coverage is 83.83%. Comparing base (0013d4c) to head (5660be4). Report is 25 commits behind head on main.

Files with missing lines Patch % Lines
cmd/oras/root/discover.go 42.85% 3 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1525 +/- ## ========================================== - Coverage 85.59% 83.83% -1.76% ========================================== Files 113 118 +5 Lines 3936 5173 +1237 ========================================== + Hits 3369 4337 +968 - Misses 340 594 +254 - Partials 227 242 +15 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

qweeah commented 3 weeks ago

Add @FeynmanZhou for UX-related discussion.

shizhMSFT commented 3 weeks ago

@njucjc Could you create an issue for the motivation of this PR?

Adding the page size option won't change the UX but may change the number of request send to the server as well as the expected server load.

[!NOTE] The pagination is not defined in the OCI distribution spec for the Referrers API. oras-go has the ReferrerListPageSize field because the code is adapted from the original ORAS Artifact Spec.

/cc @Wwwsylvia

shizhMSFT commented 3 weeks ago

The pagination is not defined in the OCI distribution spec for the Referrers API.

In other words, it depends entirely on the remote repository whether it implements the pagination defined by the ORAS artifact specification rather than the OCI distribution specification.

njucjc commented 3 weeks ago

The pagination is not defined in the OCI distribution spec for the Referrers API.

In other words, it depends entirely on the remote repository whether it implements the pagination defined by the ORAS artifact specification rather than the OCI distribution specification.

@shizhMSFT OCI distribution specification already defined the the pagination image

shizhMSFT commented 3 weeks ago

@shizhMSFT OCI distribution specification already defined the the pagination

@njucjc Not quite right. The OCI distribution spec defines how Link header works but it does not define the n query parameter.

Note that the OCI distribution spec does define n for listing tags but not for listing referrers.

Wwwsylvia commented 3 weeks ago

@njucjc Could you create an issue for the motivation of this PR?

Adding the page size option won't change the UX but may change the number of request send to the server as well as the expected server load.

Note

The pagination is not defined in the OCI distribution spec for the Referrers API. oras-go has the ReferrerListPageSize field because the code is adapted from the original ORAS Artifact Spec.

/cc @Wwwsylvia

I've opened an issue on oras-go to track this issue: https://github.com/oras-project/oras-go/issues/841

FeynmanZhou commented 3 weeks ago

I've opened an issue on oras-go to track this issue: https://github.com/oras-project/oras-go/issues/841

We also need to create an issue in the oras repo to elaborate on the feature request and why this is necessary for oras.

qweeah commented 2 weeks ago

We also need to create an issue in the oras repo to elaborate on the feature request and why this is necessary for oras.

Hi @njucjc can you kindly create an issue explaining the use case of the suggested pagination feature and why it is necessary for oras?