-
Notifications
You must be signed in to change notification settings - Fork 0
GetImage to return image tags with details #55
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
Conversation
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
| } | ||
|
|
||
| func (s *imageRouter) toImageInspect(img *image.Image) (*types.ImageInspect, error) { | ||
| refs := s.referenceBackend.References(img.ID().Digest()) |
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.
Would it also work if we'd check if s.referenceBackend is empty, and if so, fill it with img.Name() (or whatever is needed)? Something like;
var refs []reference.Named
if s.referenceBackend != nil {
refs = s.referenceBackend.References(img.ID().Digest())
} else {
// FIXME refs should contain all references of the image
refs = append(refs, img.Name())
}Or would we need the image name passed for that?
(Mostly seeing if we can keep the change to where it's a problem, and to have a clear TODO that needs fixing)
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.
Sure we could just drop this line, but my goal here is to prepare the required refactoring so we get the codebase ready while I investigate how to retrieve all tags from containerd snaphsotter
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
|
|
||
| references := i.referenceStore.References(img.ID().Digest()) | ||
|
|
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.
options.Details also does the size calculation etc; perhaps we can always set the references, but continue to make the rest of details optional ;
references := i.referenceStore.References(img.ID().Digest())
if options.Details {
// get size etc
img.Details = &image.Details{
References: references,
Size: size,
Metadata: layerMetadata,
Driver: i.layerStore.DriverName(),
LastUpdated: lastUpdated,
}
} else {
img.Details = &image.Details{
References: 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.
^^ discussed this with @ndeloof, and for this use-case (docker image inspect) we already have options.Details enabled so there's currently no need to set Details.references if it's not set.
we can't use referenceBackend when snapshotter is enabled
=> let GetImage lookup named reference for image when details are requested