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 conditionals #199

Merged
merged 8 commits into from
Jan 16, 2025
Merged

Add conditionals #199

merged 8 commits into from
Jan 16, 2025

Conversation

Itxaka
Copy link
Collaborator

@Itxaka Itxaka commented Jan 15, 2025

Adds ifOs and ifOsVersion conditionals to run things on a give OS, OS version or a mix and match of both.

Adds an unpack Image plugin that accepts a list of images, targets and platforms and will pull and extract those images in the given dir.

Adds tests and docs for both.

Which checks against the system name from os-release to be anle to run
steps in a given system

Also adds a YipConfig.ToString method that turns a yipconfig into a
simple yaml string, useful for generating stages via the YipConfig and
feeding it to yip via STDIN from code directly

Signed-off-by: Itxaka <[email protected]>
@Itxaka Itxaka changed the title Imrpovements Add conditionals Jan 15, 2025
@Itxaka Itxaka marked this pull request as ready for review January 15, 2025 14:57
This allows to pull an oci image into a given destination

Signed-off-by: Itxaka <[email protected]>
Copy link
Owner

@mudler mudler left a comment

Choose a reason for hiding this comment

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

Really liking it! just needs some docs but looking good!

}

// ExtractOCIImage will extract a given targetImage into a given targetDestination
func extractOCIImage(img v1.Image, targetDestination string) error {
Copy link
Owner

Choose a reason for hiding this comment

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

@Itxaka
Copy link
Collaborator Author

Itxaka commented Jan 15, 2025

Im a bit worried about bringing more deps due to the UnpackImage stuff.... But I think also that its a great addition to the yip plugins as nowadays it can help prepare an image with some other images, like kubernetes/k3s like getting an offline installer ongoing.... maybe the plugin should offer the possibility of pulling the image into a tar.gz as well as decompressing the image?
cc @mudler

// mkdirAll creates a directory and all necessary parents.
// It uses an vfs.FS as that doesnt have a MkdirAll method
// Same as os.MkdirAll but for vfs.FS
func mkdirAll(fs vfs.FS, path string, perm os.FileMode) error {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

maybe this should go somewhere else?

pkg/plugins/unpack_image.go Outdated Show resolved Hide resolved
@Itxaka Itxaka requested a review from mudler January 16, 2025 10:01
@Itxaka
Copy link
Collaborator Author

Itxaka commented Jan 16, 2025

readme updated, added tests, improved the pull to check for proper platform, improved skip messages for conditionals

@mudler
Copy link
Owner

mudler commented Jan 16, 2025

Im a bit worried about bringing more deps due to the UnpackImage stuff.... But I think also that its a great addition to the yip plugins as nowadays it can help prepare an image with some other images, like kubernetes/k3s like getting an offline installer ongoing.... maybe the plugin should offer the possibility of pulling the image into a tar.gz as well as decompressing the image? cc @mudler

this would be a nice addition (pulling and extracting the image from a saved tar) but let's do step by step and take care of it later when it comes up

@mudler mudler merged commit cd95d05 into master Jan 16, 2025
3 checks passed
Copy link
Collaborator

@jimmykarily jimmykarily left a comment

Choose a reason for hiding this comment

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

nice!

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.

3 participants