buildpacks / imgutil

Helpful utilities for working with images
Apache License 2.0
24 stars 41 forks source link

Implementation of CNB Image interface using OCI layout format #165

Closed jjbustamante closed 1 year ago

jjbustamante commented 1 year ago

Summary

This pull request implements the CNB Image interface using OCI layout format.

A new layout package was added to expose the implementation of the Image interface

The implementation exposes the following classes:

classDiagram
class ImageOption {
    <<interface>>
    FromBaseImage(base v1.Image) ImageOption
    FromBaseImagePath(path string) ImageOption
    WithPreviousImage(path string)
}
class LayoutImage {
    NewImage(path string, ops ...ImageOption) (*Image, error)
}
class SparseImage {
     NewImage(path string, from v1.Image) (*Image, error) 
}

Where

Output

When the image.Save() method is called it will save the output in the local filesystem at the path provided during initialization in OCI layout format, for example:

Screenshot 2023-01-11 at 8 15 51 PM

The previous image shows a couple of examples of two images save in OCI layout format on disk

Before

It was not possible to save images in OCI layout format

After

New package layout is exposed with the new implementation.

Notes

Fixes #162

Signed-off-by: Juan Bustamante jbustamante@vmware.com

natalieparellano commented 1 year ago

@jjbustamante added a few nits... I had some questions in my previous set of comments that would be good to answer, but overall I'm feeling really good about this PR :)

jjbustamante commented 1 year ago

Hi @jabrown85

If you can take a look and provide some feedback will be awesome! I already went to some of the comments Natalie left me.