Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for creating empty image config #1973

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kipz
Copy link

@kipz kipz commented Jul 9, 2024

According to the current OCI spec:

Content other than OCI container images MAY be packaged using the image manifest. When this is done, the config.mediaType value MUST be set to a value specific to the artifact type or the empty value.

It's currently possible to set the config MediaType:

img = mutate.ConfigMediaType(img, "application/vnd.oci.empty.v1+json")

But it's not currently possible (as far as I can tell), to create the rest of the descriptor:

{
  "mediaType": "application/vnd.oci.empty.v1+json",
  "digest": "sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a",
  "size": 2,
  "data": "e30="
}

This PR adds a new mutate function to achieve this:

img = mutate.EmptyConfig(img)

An alternative, and maybe more general approach, would be to expose a mutate function to set the value of Manifest.Config.Data directly, and calculate the size/digest during compute.

Copy link

google-cla bot commented Jul 9, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@kipz kipz changed the title Add support for creating empty empty image config Add support for creating empty image config Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant