diff options
author | Nalin Dahyabhai <nalin@redhat.com> | 2019-10-16 12:00:12 -0400 |
---|---|---|
committer | Nalin Dahyabhai <nalin@redhat.com> | 2019-10-29 13:35:19 -0400 |
commit | 07195ff09fdcb0d2d3a044c92665b082d6e742b1 (patch) | |
tree | f69d2b1d0f904706e260962ca64674a231a0d071 /pkg/adapter | |
parent | b9313d355e8cd6307d8772ad9c21958ffe981e5b (diff) | |
download | podman-07195ff09fdcb0d2d3a044c92665b082d6e742b1.tar.gz podman-07195ff09fdcb0d2d3a044c92665b082d6e742b1.tar.bz2 podman-07195ff09fdcb0d2d3a044c92665b082d6e742b1.zip |
API: report multiple digests for images
Be prepared to report multiple image digests for images which contain
multiple manifests but, because they continue to have the same set of
layers and the same configuration, are considered to be the same image.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Diffstat (limited to 'pkg/adapter')
-rw-r--r-- | pkg/adapter/runtime_remote.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/adapter/runtime_remote.go b/pkg/adapter/runtime_remote.go index fef3986f1..12bf550f2 100644 --- a/pkg/adapter/runtime_remote.go +++ b/pkg/adapter/runtime_remote.go @@ -146,6 +146,7 @@ type remoteImage struct { InputName string Names []string Digest digest.Digest + Digests []digest.Digest isParent bool Runtime *LocalRuntime TopLayer string @@ -226,10 +227,15 @@ func imageInListToContainerImage(i iopodman.Image, name string, runtime *LocalRu if err != nil { return nil, err } + var digests []digest.Digest + for _, d := range i.Digests { + digests = append(digests, digest.Digest(d)) + } ri := remoteImage{ InputName: name, ID: i.Id, Digest: digest.Digest(i.Digest), + Digests: digests, Labels: i.Labels, RepoTags: i.RepoTags, RepoDigests: i.RepoTags, @@ -352,6 +358,11 @@ func (ci *ContainerImage) Digest() digest.Digest { return ci.remoteImage.Digest } +// Digests returns the image's digests +func (ci *ContainerImage) Digests() []digest.Digest { + return append([]digest.Digest{}, ci.remoteImage.Digests...) +} + // Labels returns a map of the image's labels func (ci *ContainerImage) Labels(ctx context.Context) (map[string]string, error) { return ci.remoteImage.Labels, nil |