Skip to content

Commit

Permalink
imagetools inspect: missing manifest digest for manifest-list (json)
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <[email protected]>
  • Loading branch information
crazy-max committed Feb 27, 2022
1 parent 38195b6 commit 8e42996
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion util/imagetools/printers.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/docker/buildx/util/maputil"
"github.com/docker/distribution/reference"
binfotypes "github.com/moby/buildkit/util/buildinfo/types"
"github.com/opencontainers/go-digest"
ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
"golang.org/x/sync/errgroup"
Expand Down Expand Up @@ -150,7 +151,21 @@ func (p *Printer) Print(raw bool, out io.Writer) error {
case images.MediaTypeDockerSchema2Manifest, ocispecs.MediaTypeImageManifest:
manifest = p.manifest
case images.MediaTypeDockerSchema2ManifestList, ocispecs.MediaTypeImageIndex:
manifest = p.index
manifest = struct {
SchemaVersion int `json:"schemaVersion"`
MediaType string `json:"mediaType,omitempty"`
Digest digest.Digest `json:"digest"`
Size int64 `json:"size"`
Manifests []ocispecs.Descriptor `json:"manifests"`
Annotations map[string]string `json:"annotations,omitempty"`
}{
SchemaVersion: p.index.Versioned.SchemaVersion,
MediaType: p.index.MediaType,
Digest: p.manifest.Digest,
Size: p.manifest.Size,
Manifests: p.index.Manifests,
Annotations: p.index.Annotations,
}
}

switch {
Expand Down

0 comments on commit 8e42996

Please sign in to comment.