Merge pull request #2685 from Random-Liu/expose-labels

Add `Labels()` to client.Image.
This commit is contained in:
Derek McGowan 2018-09-26 10:25:42 -07:00 committed by GitHub
commit f88d3e5d6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,6 +37,8 @@ type Image interface {
Name() string Name() string
// Target descriptor for the image content // Target descriptor for the image content
Target() ocispec.Descriptor Target() ocispec.Descriptor
// Labels of the image
Labels() map[string]string
// Unpack unpacks the image's content into a snapshot // Unpack unpacks the image's content into a snapshot
Unpack(context.Context, string) error Unpack(context.Context, string) error
// RootFS returns the unpacked diffids that make up images rootfs. // RootFS returns the unpacked diffids that make up images rootfs.
@ -86,6 +88,10 @@ func (i *image) Target() ocispec.Descriptor {
return i.i.Target return i.i.Target
} }
func (i *image) Labels() map[string]string {
return i.i.Labels
}
func (i *image) RootFS(ctx context.Context) ([]digest.Digest, error) { func (i *image) RootFS(ctx context.Context) ([]digest.Digest, error) {
provider := i.client.ContentStore() provider := i.client.ContentStore()
return i.i.RootFS(ctx, provider, i.platform) return i.i.RootFS(ctx, provider, i.platform)