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!: implement the referrers route in the v2 package #32

Merged
merged 3 commits into from
Nov 4, 2022
Merged

feat!: implement the referrers route in the v2 package #32

merged 3 commits into from
Nov 4, 2022

Conversation

wangxiaoxuan273
Copy link

Implement the referrers route in the registry/api/v2 package. Path with filtering on ArtifactType is also implemented. Unit tests are included. The next pr will implement referrersHandler but probably will not implement filtering yet.

Part 5 of #21

Signed-off-by: wangxiaoxuan273 [email protected]

@wangxiaoxuan273 wangxiaoxuan273 changed the title feat!: implement referrers route in the v2 package feat!: implement the referrers route in the v2 package Oct 31, 2022
@codecov-commenter
Copy link

codecov-commenter commented Oct 31, 2022

Codecov Report

Merging #32 (2a611e0) into main (0e64ff7) will increase coverage by 0.00%.
The diff coverage is 62.50%.

@@           Coverage Diff           @@
##             main      #32   +/-   ##
=======================================
  Coverage   57.18%   57.18%           
=======================================
  Files         107      107           
  Lines       10982    10990    +8     
=======================================
+ Hits         6280     6285    +5     
- Misses       3999     4001    +2     
- Partials      703      704    +1     
Impacted Files Coverage Δ
registry/api/v2/descriptors.go 100.00% <ø> (ø)
registry/api/v2/routes.go 100.00% <ø> (ø)
registry/api/v2/urls.go 75.30% <62.50%> (-0.67%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Description: "Fetch the referrers of the artifact identified by `digest`.",
Requests: []RequestDescriptor{
{
Name: "referrers",

Choose a reason for hiding this comment

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

nit:

Suggested change
Name: "referrers",
Name: "Referrers",

Copy link
Author

Choose a reason for hiding this comment

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

changed.

Comment on lines 1626 to 1633
Format: `{
"schemaVersion": 2,
"mediaType": "application/vnd.oci.image.index.v1+json",
"manifests": [
<manifest>,
...
]
}`,

Choose a reason for hiding this comment

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

The indentation is not correct.

Copy link
Member

Choose a reason for hiding this comment

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

It looks OK on editor.🤔

linkHeader,
},
Body: BodyDescriptor{
ContentType: "application/json",

Choose a reason for hiding this comment

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

Should it be application/vnd.oci.image.index.v1+json?

Copy link
Author

Choose a reason for hiding this comment

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

replaced.

Comment on lines +1638 to +1641
{
Description: "The registry does not support referrers API.",
StatusCode: http.StatusNotFound,
},

Choose a reason for hiding this comment

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

It is also possible that the repository does not exists.

/cc @Wwwsylvia @m5i-work

Copy link
Member

Choose a reason for hiding this comment

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

We should return 404 and error code NAME_UNKNOWN when the repository does not exist.
References:

Copy link
Author

Choose a reason for hiding this comment

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

Added the variable repositoryNotFoundResponseDescriptor defined in descriptors.go to address this scenario. It satisfies your specifications.
image
Now the Failures responses look like this, note the added line:
image

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

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

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

LGTM

@shizhMSFT shizhMSFT merged commit 6f0e3ea into oras-project:main Nov 4, 2022
@wangxiaoxuan273 wangxiaoxuan273 deleted the v2-pkg branch November 4, 2022 09:41
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.

4 participants