-
Notifications
You must be signed in to change notification settings - Fork 5
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
Conversation
Codecov Report
@@ 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
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
registry/api/v2/descriptors.go
Outdated
Description: "Fetch the referrers of the artifact identified by `digest`.", | ||
Requests: []RequestDescriptor{ | ||
{ | ||
Name: "referrers", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
Name: "referrers", | |
Name: "Referrers", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed.
registry/api/v2/descriptors.go
Outdated
Format: `{ | ||
"schemaVersion": 2, | ||
"mediaType": "application/vnd.oci.image.index.v1+json", | ||
"manifests": [ | ||
<manifest>, | ||
... | ||
] | ||
}`, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.🤔
registry/api/v2/descriptors.go
Outdated
linkHeader, | ||
}, | ||
Body: BodyDescriptor{ | ||
ContentType: "application/json", |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replaced.
{ | ||
Description: "The registry does not support referrers API.", | ||
StatusCode: http.StatusNotFound, | ||
}, |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signed-off-by: wangxiaoxuan273 <[email protected]>
Signed-off-by: wangxiaoxuan273 <[email protected]>
Signed-off-by: wangxiaoxuan273 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Implement the
referrers
route in theregistry/api/v2
package. Path with filtering onArtifactType
is also implemented. Unit tests are included. The next pr will implementreferrersHandler
but probably will not implement filtering yet.Part 5 of #21
Signed-off-by: wangxiaoxuan273 [email protected]