From 52fbd4e2dccff51733cb57ba2315437a3dd63316 Mon Sep 17 00:00:00 2001 From: LochanRn Date: Fri, 24 Sep 2021 15:32:47 +0530 Subject: [PATCH] changes to support any mediatype for layers on download Signed-off-by: LochanRn (cherry picked from commit 9e29f1619b051345683dc5ad12435bca8b186c16) --- internal/experimental/registry/client.go | 5 ++++- internal/experimental/registry/constants.go | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/experimental/registry/client.go b/internal/experimental/registry/client.go index 7d4245188d9..cc9e1fe7961 100644 --- a/internal/experimental/registry/client.go +++ b/internal/experimental/registry/client.go @@ -224,7 +224,7 @@ func (c *Client) Pull(ref string, options ...PullOption) (*PullResult, error) { minNumDescriptors := 1 // 1 for the config if operation.withChart { minNumDescriptors++ - allowedMediaTypes = append(allowedMediaTypes, ChartLayerMediaType) + allowedMediaTypes = append(allowedMediaTypes, ChartLayerMediaType, LegacyChartLayerMediaType) } if operation.withProv { if !operation.ignoreMissingProv { @@ -256,6 +256,9 @@ func (c *Client) Pull(ref string, options ...PullOption) (*PullResult, error) { chartDescriptor = &d case ProvLayerMediaType: provDescriptor = &d + case LegacyChartLayerMediaType: + chartDescriptor = &d + fmt.Fprintf(c.out, "Warning: chart media type %s is deprecated\n", LegacyChartLayerMediaType) } } if configDescriptor == nil { diff --git a/internal/experimental/registry/constants.go b/internal/experimental/registry/constants.go index 97114cb2379..876e4dc1385 100644 --- a/internal/experimental/registry/constants.go +++ b/internal/experimental/registry/constants.go @@ -31,4 +31,7 @@ const ( // ProvLayerMediaType is the reserved media type for Helm chart provenance files ProvLayerMediaType = "application/vnd.cncf.helm.chart.provenance.v1.prov" + + // LegacyChartLayerMediaType is the legacy reserved media type for Helm chart package content. + LegacyChartLayerMediaType = "application/tar+gzip" )