From f6224f78ba1c0b5e5a71678fd9d493465ddd5c9d Mon Sep 17 00:00:00 2001 From: Mike Brown Date: Mon, 18 Jun 2018 15:18:59 -0500 Subject: [PATCH] register oci image index Signed-off-by: Mike Brown --- manifest/manifestlist/manifestlist.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/manifest/manifestlist/manifestlist.go b/manifest/manifestlist/manifestlist.go index 0d5c9af1..7be29714 100644 --- a/manifest/manifestlist/manifestlist.go +++ b/manifest/manifestlist/manifestlist.go @@ -45,6 +45,21 @@ func init() { if err != nil { panic(fmt.Sprintf("Unable to register manifest: %s", err)) } + + imageIndexFunc := func(b []byte) (distribution.Manifest, distribution.Descriptor, error) { + m := new(DeserializedManifestList) + err := m.UnmarshalJSON(b) + if err != nil { + return nil, distribution.Descriptor{}, err + } + + dgst := digest.FromBytes(b) + return m, distribution.Descriptor{Digest: dgst, Size: int64(len(b)), MediaType: v1.MediaTypeImageIndex}, err + } + err = distribution.RegisterManifestSchema(v1.MediaTypeImageIndex, imageIndexFunc) + if err != nil { + panic(fmt.Sprintf("Unable to register OCI Image Index: %s", err)) + } } // PlatformSpec specifies a platform where a particular image manifest is