Change mediatype for chart content layer

Mediatype changed to application/tar+gzip. Please see the
following OCI mailing list item for more info:
https://groups.google.com/a/opencontainers.org/forum/#!topic/dev/pdc1lucm_Ak

Also, improved check for invalid manifests, a nil reference error was
occurring when upgrading from existing cache with old mediatype.

Signed-off-by: Josh Dolitsky <393494+jdolitsky@users.noreply.github.com>
pull/6779/head
Josh Dolitsky 5 years ago
parent 33338eab17
commit 5e1ad8b025

@ -122,10 +122,14 @@ func (cache *Cache) FetchReference(ref *Reference) (*CacheRefSummary, error) {
contentLayer = &layer contentLayer = &layer
} }
} }
if contentLayer.Size == 0 { if contentLayer == nil {
return &r, errors.New( return &r, errors.New(
fmt.Sprintf("manifest does not contain a layer with mediatype %s", HelmChartContentLayerMediaType)) fmt.Sprintf("manifest does not contain a layer with mediatype %s", HelmChartContentLayerMediaType))
} }
if contentLayer.Size == 0 {
return &r, errors.New(
fmt.Sprintf("manifest layer with mediatype %s is of size 0", HelmChartContentLayerMediaType))
}
r.ContentLayer = contentLayer r.ContentLayer = contentLayer
info, err := cache.ociStore.Info(ctx(cache.out, cache.debug), contentLayer.Digest) info, err := cache.ociStore.Info(ctx(cache.out, cache.debug), contentLayer.Digest)
if err != nil { if err != nil {

@ -21,7 +21,7 @@ const (
HelmChartConfigMediaType = "application/vnd.cncf.helm.config.v1+json" HelmChartConfigMediaType = "application/vnd.cncf.helm.config.v1+json"
// HelmChartContentLayerMediaType is the reserved media type for Helm chart package content // HelmChartContentLayerMediaType is the reserved media type for Helm chart package content
HelmChartContentLayerMediaType = "application/vnd.cncf.helm.chart.content.layer.v1+tar" HelmChartContentLayerMediaType = "application/tar+gzip"
) )
// KnownMediaTypes returns a list of layer mediaTypes that the Helm client knows about // KnownMediaTypes returns a list of layer mediaTypes that the Helm client knows about

Loading…
Cancel
Save