buildpacks / imgutil

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

Refactor: local images should be v1.Images #238

Closed natalieparellano closed 6 months ago

natalieparellano commented 6 months ago

Partially resolves https://github.com/buildpacks/imgutil/issues/207

Introduces a locallayout package and a new imgutil.CNBImage struct.

The CNBImage struct wraps a v1.Image, which could be locallayout, remote, layout, etc. and performs all the modifications to the image that are necessary for a CNB build (such as re-using a layer from a previous image).

locallayout.Image implements a v1.Image by wrapping output from the daemon. However, it does not contain any CNB logic. It does have code that is specific to constructing new images and saving them to the daemon.

This should eventually allow us to delete duplicated code in the remote & layout packages that modifies images in those packages, as we can remove all of the CNB logic (and then some).

Additionally, this should make it easier for us to send images to the daemon in OCI layout format.

This PR simply adds code but if locallayout.Image works well in place of local.Image we can remove local.

natalieparellano commented 6 months ago

@jabrown85 I would love to get your thoughts on this one 🙏🏼