feat(find-images): 4509 include archives in find image#4551
feat(find-images): 4509 include archives in find image#4551chaospuppy wants to merge 18 commits intozarf-dev:mainfrom
Conversation
✅ Deploy Preview for zarf-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
@AustinAbro321 when you have a moment, please take a look. I am still going to update a few unit tests. |
aad61df to
6d872f4
Compare
b03b517 to
f35514c
Compare
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
AustinAbro321
left a comment
There was a problem hiding this comment.
Good start! Thanks for taking this on
src/pkg/images/unpack.go
Outdated
| // It returns a list of images found in the extracted OCI layout. | ||
| func FindImagesInArchive(ctx context.Context, imageArchive, destDir string) ([]string, error) { | ||
| // Create a temporary directory for extraction | ||
| tmpdir, err := utils.MakeTempDir("") |
There was a problem hiding this comment.
The extraction logic in this block is mostly duplicated. Lets make a common function to de-duplicate it
There was a problem hiding this comment.
Made a few changes with this in mind
src/pkg/packager/load/load.go
Outdated
| // SkipVersionCheck skips version requirement validation | ||
| SkipVersionCheck bool | ||
| // SkipImageArchivesImages ignores schema validation errors when imageArchives does not include an images list | ||
| SkipEmptyImageArchivesImages bool |
There was a problem hiding this comment.
I'd prefer a strategy where we create a function load.PackageDefinitionNoValidate() then also make a public function load.Validate(). Keep the load.PackageDefinition function this way validation happens by default.
I believe a public validate function could be generally useful for SDK users who might be creating packages without zarf.yaml files, additionally it'll leave more room in the future for more generic solutions if we need to skip validation for a similar reason
There was a problem hiding this comment.
I'm happy to make that split still, but our failure was while validating the file itself here, rather than during the validation of v1alpha1.ZarfPackage. Therefore, it wasn't useful for us to delay validation after adding a placeholder image as we previously discussed to the v1alpha1.ZarfPackage.
I could split them and then add some work to change the zarf.ymal on disk to add an empty array there, but that didn't seem like desirable behavior.
There was a problem hiding this comment.
Alternatively, I could also split out a Validate and ValidateWithoutSchemaValidation (not literally that name, but something like that) and use the later
src/pkg/packager/find_images.go
Outdated
| return nil, fmt.Errorf("failed to unpack image archive %s: %w", archive.Path, err) | ||
| } | ||
| for _, image := range archiveImages { | ||
| matchedImages[image] = true |
There was a problem hiding this comment.
I think matched images isn't the right construct. Maybe a new field should be added such as archiveImages. One of the goals of find-images is to be able to copy and paste the output into your zarf.yaml. Currently you'd see this output, which would result in trying to pull the image from the internet if you copied and pasted it
2026-01-27 16:38:42 INF looking up cosign artifacts for discovered images count=3
components:
- name: kiwix-serve
images:
- docker.io/library/kiwix-data:local
- ghcr.io/kiwix/kiwix-serve:3.5.0-2
- kiwix-data:localThere was a problem hiding this comment.
I see, good point, I missed the desire to pull images from the image archive on disk after zarf.yaml has been updated with the output of zarf dev find-images. I'll fix that up!
There was a problem hiding this comment.
@AustinAbro321 to clarify, are you hoping to see images elements expressed in a such as way as to direct Zarf to pull them from the archive, rather than from the internet?
There was a problem hiding this comment.
Ah I missed your comment before asking, I think I see the answer in #4577
There was a problem hiding this comment.
Just went back and clarified #4577 a bit, but just to write here as well, we should no longer include images because they're in an image archive. If they're in both a manifest we should check if the image archive contains that image, then in the output to the user structure it so it's in the image archive, and the user can simply copy and paste.
There was a problem hiding this comment.
Image archives functionality should also work with packager.UpdateImages
08c339e to
9534ea6
Compare
|
Hello @chaospuppy, I reazlied that the behavior I proposed in #4509, didn't really fit the If you do adjust this PR for #4577, don't worry about validation, assume the given zarf.yaml file is valid |
|
@AustinAbro321 Are you thinking about handling validation differently in the near future? Trying to get an understanding for which changes I should back out. I am also happy to keep the validation changes in, including making Validation public and creating PackageDefinitionWithoutValidation. |
|
@chaospuppy Very possibly handling validation in the near future yes. I suggest backing out of the validation changes in this PR |
…eholder images list, add skipimagearchivesimages definition option Signed-off-by: Tim Seagren <timseagren@defenseunicorns.com>
…efinitionOption for skipping imagearchives images schema findings Signed-off-by: Tim Seagren <timseagren@defenseunicorns.com>
…es output Signed-off-by: Tim Seagren <timseagren@defenseunicorns.com>
Signed-off-by: Tim Seagren <timseagren@defenseunicorns.com>
Signed-off-by: Tim Seagren <timseagren@defenseunicorns.com>
Signed-off-by: Tim Seagren <timseagren@defenseunicorns.com>
Signed-off-by: Tim Seagren <timseagren@defenseunicorns.com>
…dev#4554) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Tim Seagren <timseagren@defenseunicorns.com>
…-organization group (zarf-dev#4553) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Tim Seagren <timseagren@defenseunicorns.com>
…ev#4552) Signed-off-by: Jason Washburn <jason.washburn@gmail.com> Signed-off-by: Tim Seagren <timseagren@defenseunicorns.com>
Signed-off-by: Austin Abro <austinabro321@gmail.com> Signed-off-by: Tim Seagren <timseagren@defenseunicorns.com>
Signed-off-by: Austin Abro <austinabro321@gmail.com> Signed-off-by: Tim Seagren <timseagren@defenseunicorns.com>
Signed-off-by: Austin Abro <austinabro321@gmail.com> Signed-off-by: Tim Seagren <timseagren@defenseunicorns.com>
Signed-off-by: Tim Seagren <timseagren@defenseunicorns.com>
…images --update Signed-off-by: Tim Seagren <timseagren@defenseunicorns.com>
cc9dbd7 to
7bceaee
Compare
src/pkg/packager/find_images.go
Outdated
| // PotentialMatches contains potential container images found by a regex | ||
| PotentialMatches []string | ||
| // ArchiveImages contains images that are included in Matches, but are provided with an imageArchive | ||
| ArchiveImages []string |
There was a problem hiding this comment.
Not yet doing a full review, as this is in draft, but thinking about the architecture here. I believe we shouldn't change anything in the packager.FindImages function in this PR. This function should be focused on finding images from manifests and charts. The logic for determining which of those images are in an image archive so we can customize the print out should be outside of this function.
There was a problem hiding this comment.
Okay that makes sense, I'll move imageArchives logic into a separate function that can be used for post-processing the images located in FindImages for find-images.
Description
This MR resolves #4509 by doing the following:
imageArchiveskeys. Currently this finding is only removed when calling PackageDefinition from FindImagesimageArchives.pathRelated Issue
Fixes #4509
Checklist before merging