Skip to content

crane: mutate OCI image layout with annotations, layers etc. #1433

Open
@developer-guy

Description

@developer-guy

Describe the bug

This is not a bug, and this is a feature.

Additional context

Recently, @sudo-bmitch talked about OCI image layout1. He showed a demo of making file operations on the OCI image layout directory for adding new blobs, annotations, etc. crane already has the support of working with OCI image layout through a package pkg/v1/layout available in go-containerregistry but editing the OCI image layout for such operations adding new blobs, annotations, etc. is not possible, so, we talked with @imjasonh about this, and mutate cmd is the best place to implement this. Based on that, I've tested a sample code to make changes to OCI image layout, and it worked:

img2 := mutate.Annotations(img, annotations).(v1.Image)
err = p.ReplaceImage(img2, match.Digests(digest))
if err != nil {
	return fmt.Errorf("replacing image: %w", err)
}

PTAL @Dentrax

Footnotes

  1. https://www.youtube.com/watch?v=TJVoFKTm9I0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions