-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Fixes: Distribution API #17726 #25378
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: kanlac The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.
Thanks for the PR, we should avoid using that code considering that all our image handling is done in containers/image so we should use that.
The github.com/distribution/reference dependency causes way to much bloat (binary size increase)
b125e3d
to
90ba130
Compare
I used the image API to handle the query, keeping things lightweight with no new deps. Please take a look—if it looks good, I’ll add support for different manifest types next. @Luap99 |
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.
Thanks, that looks much better. I don't know the c/image API well so @mtrmac might having a look here?
Oh and please add |
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.
Just a very brief skim for now, I didn’t check what the API is expected to do.
cf24ec6
to
3ed7716
Compare
|
||
namedRef, imgRef, err := parseImageReference(name) | ||
if err != nil { | ||
utils.Error(w, http.StatusUnauthorized, err) |
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.
Is StatusUnauthorized
correct for a format error?
45251c5
to
22cdd39
Compare
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 c/image API usage looks generally fine now.
(I didn’t check what the API is expected to return.)
switch manType { | ||
case ocispec.MediaTypeImageManifest, manifest.DockerV2Schema2MediaType: | ||
config, err := img.OCIConfig(ctx) | ||
if err != nil { | ||
return nil, fmt.Errorf("error getting OCI config: %w", err) | ||
} |
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.
Is there a reason for the restrictive manType
, excluding schema1?
OTOH this will fail for OCI artifacts. Should it fail? I really don’t know. If not, check for NonImageArtifactError
.
Signed-off-by: Kan Cheung <[email protected]>
Does this PR introduce a user-facing change?