Skip to content

Support non-compressed/foreign image layer media types #1133

Closed
@rvmiller89

Description

#261 added support for OCI Image Layout, but only supports Image Layers of two media types:

  • application/vnd.oci.image.layer.v1.tar+gzip
  • application/vnd.docker.image.rootfs.diff.tar.gzip

For any other value of media type it returns an error (see the TODO's):

switch desc.MediaType {
case types.OCILayer, types.DockerLayer:
return &compressedBlob{
path: li.path,
desc: desc,
}, nil
default:
// TODO: We assume everything is a compressed blob, but that might not be true.
// TODO: Handle foreign layers.
return nil, fmt.Errorf("unexpected media type: %v for layer: %v", desc.MediaType, desc.Digest)
}

Issue 1. Supporting non-compressed layers

The OCI Image Manifest specification requires support for at least 4 types, including 2 non-compressed layer types (.tar):

  • application/vnd.oci.image.layer.v1.tar
  • application/vnd.oci.image.layer.v1.tar+gzip
  • application/vnd.oci.image.layer.nondistributable.v1.tar
  • application/vnd.oci.image.layer.nondistributable.v1.tar+gzip

Issue 2. Supporting foreign {compressed, non-compressed} layers

The OCI Artifacts project defines additional media types like Helm Charts and custom media types. Examples include:

  • application/vnd.cncf.helm.chart.layer.v1.tar+gzip
  • application/tar+gzip
  • etc.

Possible work-arounds

  1. Allow any media type: I verified removing the explicit check for types.OCILayer, types.DockerLayer allows us to push layers of arbitrary media types, but wasn't sure how this might conflict with compressedBlob.
  2. Allow any media type ending in +gzip: (Image Manifest specification mentions "Entries in this field will frequently use the +gzip types.")
  3. Something else?

Happy to open a PR to support this, but wanted to check how we might want to handle it.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions