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

Refactor: local images should be v1.Images #238

Merged
merged 2 commits into from
Jan 16, 2024
Merged

Conversation

natalieparellano
Copy link
Member

Partially resolves #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.

Introduces a locallayout package and a new imgutil.CNBImage struct.
The CNBImage struct wraps a v1.Image, which could be locallayout, remote, layout, etc.
locallayout.Image implements a v1.Image by wrapping output from the daemon.
This should eventually allow us to delete duplicated code in the remote & layout packages
that modifies images in those packages.
Additionally, this should make it easier for us to send images to the daemon in OCI layout format.

Signed-off-by: Natalie Arellano <narellano@vmware.com>
locallayout/new.go Outdated Show resolved Hide resolved
@natalieparellano natalieparellano marked this pull request as ready for review January 12, 2024 21:22
@natalieparellano natalieparellano requested a review from a team as a code owner January 12, 2024 21:22
@natalieparellano
Copy link
Member Author

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

Copy link
Contributor

@jabrown85 jabrown85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds great to me!

Signed-off-by: Natalie Arellano <narellano@vmware.com>
@natalieparellano natalieparellano merged commit 6fa1289 into main Jan 16, 2024
3 checks passed
@natalieparellano natalieparellano deleted the refactor/v1image branch January 16, 2024 16:39
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.

imgutil images should be v1.Images
2 participants