Skip to content

feat!: allow pulling images by index sha#4879

Merged
AustinAbro321 merged 31 commits into
mainfrom
allow-index-sha-pulling
May 27, 2026
Merged

feat!: allow pulling images by index sha#4879
AustinAbro321 merged 31 commits into
mainfrom
allow-index-sha-pulling

Conversation

@AustinAbro321
Copy link
Copy Markdown
Member

@AustinAbro321 AustinAbro321 commented May 7, 2026

Breaking Changes

Breaking changes are limited to the SDK in src/pkg/images

  • ImageWithManifest type removed → replaced by PulledImage. Pull and UnPack now return this type.
    • Old: struct { Image transform.Image; Manifest ocispec.Manifest }
    • New: struct { Image transform.Image } — the Manifest field is gone. SDK users who relied on the returned manifest must fetch it themselves from the OCI store.
  • PushOptions.Arch field removed. I believe this was never actually needed, we can just push the architectures that the layout includes.

Description

This implements pulling image indexes. It adds a version requirements so that Zarf can correctly pull the sha'd images. It also changes the deploy check to allow deploying to any node when an index sha image exists in the package.

When there are multiple container images pointed to an index, Zarf will create an SBOM for each image.

Pulling Indexes place a minimumVersionRequirement of v0.76.0. Also due to our pull logic not properly handling indexes, Zarf will panic if it tries to pull a package with indexes before this change.

I considered adding a metadata field, or requiring .metadata.architecture: multi for index pulls, but I think that will cause more confusion than improvements to the UX. We don't block users from pulling sha's of different digests. I'm hoping the log of the platform during pull will be enough of an indicator to those using index sha's mistakenly.

Related Issue

Relates to #2425. I'll probably close this is merged, but I want to comment on how this doesn't implement tags or specific architectures and ask the issue thread to make an issue if this is a feature they desire.

Checklist before merging

Signed-off-by: Austin Abro <[email protected]>
Signed-off-by: Austin Abro <[email protected]>
Signed-off-by: Austin Abro <[email protected]>
Signed-off-by: Austin Abro <[email protected]>
Signed-off-by: Austin Abro <[email protected]>
Signed-off-by: Austin Abro <[email protected]>
Signed-off-by: Austin Abro <[email protected]>
Signed-off-by: Austin Abro <[email protected]>
Signed-off-by: Austin Abro <[email protected]>
Signed-off-by: Austin Abro <[email protected]>
Signed-off-by: Austin Abro <[email protected]>
Signed-off-by: Austin Abro <[email protected]>
Signed-off-by: Austin Abro <[email protected]>
@netlify
Copy link
Copy Markdown

netlify Bot commented May 7, 2026

Deploy Preview for zarf-docs canceled.

Name Link
🔨 Latest commit 184d8b6
🔍 Latest deploy log https://app.netlify.com/projects/zarf-docs/deploys/6a15bf70c4fffa0008b1db5b

Signed-off-by: Austin Abro <[email protected]>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 7, 2026

Codecov Report

❌ Patch coverage is 47.91667% with 200 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/pkg/packager/layout/sbom.go 10.90% 94 Missing and 4 partials ⚠️
src/pkg/images/common.go 58.75% 23 Missing and 10 partials ⚠️
src/pkg/zoci/pull.go 58.62% 17 Missing and 7 partials ⚠️
src/pkg/images/pull.go 60.00% 11 Missing and 3 partials ⚠️
src/pkg/packager/layout/assemble.go 79.24% 7 Missing and 4 partials ⚠️
src/pkg/images/push.go 43.75% 8 Missing and 1 partial ⚠️
src/pkg/packager/deploy.go 25.00% 8 Missing and 1 partial ⚠️
src/pkg/packager/layout/package.go 0.00% 2 Missing ⚠️
Files with missing lines Coverage Δ
src/pkg/images/unpack.go 57.14% <100.00%> (+3.04%) ⬆️
src/pkg/packager/mirror.go 0.00% <ø> (ø)
src/pkg/packager/layout/package.go 66.26% <0.00%> (-0.23%) ⬇️
src/pkg/images/push.go 48.80% <43.75%> (-0.50%) ⬇️
src/pkg/packager/deploy.go 3.98% <25.00%> (+0.11%) ⬆️
src/pkg/packager/layout/assemble.go 45.18% <79.24%> (+2.00%) ⬆️
src/pkg/images/pull.go 50.13% <60.00%> (-0.27%) ⬇️
src/pkg/zoci/pull.go 51.64% <58.62%> (-0.53%) ⬇️
src/pkg/images/common.go 43.07% <58.75%> (+8.36%) ⬆️
src/pkg/packager/layout/sbom.go 37.83% <10.90%> (-10.38%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: Austin Abro <[email protected]>
Signed-off-by: Austin Abro <[email protected]>
@AustinAbro321 AustinAbro321 changed the title Allow index sha pulling feat: allow pulling images by index sha May 8, 2026
Signed-off-by: Austin Abro <[email protected]>
Signed-off-by: Austin Abro <[email protected]>
Signed-off-by: Austin Abro <[email protected]>
Signed-off-by: Austin Abro <[email protected]>
Signed-off-by: Austin Abro <[email protected]>
Signed-off-by: Austin Abro <[email protected]>
Signed-off-by: Austin Abro <[email protected]>
@AustinAbro321 AustinAbro321 changed the title feat: allow pulling images by index sha feat!: allow pulling images by index sha May 8, 2026
Signed-off-by: Austin Abro <[email protected]>
@AustinAbro321 AustinAbro321 marked this pull request as ready for review May 8, 2026 19:13
@AustinAbro321 AustinAbro321 requested review from a team as code owners May 8, 2026 19:13
Comment thread src/pkg/images/common.go Outdated
}

// sumManifestsSize walks each descriptor (recursing into nested indexes) and totals up the byte
// size of every referenced blob plus one "arch[/variant]" string per leaf manifest.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

More for my education looking at the OCI spec -

  1. do we need to consider OS? Variety of implications here
  2. seems unlikely but will there ever be a case of a shared layer?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

  1. For now no, we hardcode os: linux when pulling packages.
  2. It's technically possible, this function should have had unit tests anyhow. Added logic to handle this

@brandtkeller brandtkeller self-assigned this May 26, 2026
require.GreaterOrEqual(t, count, 2, "expected per-platform SBOMs for the digested multi-platform image")

stdOut, stdErr, err = e2e.Zarf(t, "package", "deploy", pulledPkgPath, "--confirm", "--skip-version-check")
require.NoError(t, err, stdOut, stdErr)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need fidelity in the state of the pod in the cluster to confirm any deployment behaviors or are we confident in it if the deployment occurs successfully?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm confident if the deploy occurs successfully.

Copy link
Copy Markdown
Member

@brandtkeller brandtkeller left a comment

Choose a reason for hiding this comment

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

thoughtfully implemented - no blocking comments but a few minor thoughts or observations. lgtm

Reason: "This package contains image archives which will only be recognized on v0.68.0+",
})
break
hasIndex := false
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: nonblocking - the split here between buildPath, hasIndex and collectVersionRequirements is entirely functional but feels a little awkward. in so much as I think buildPath could be a parameter and then imageLayoutasIndex could be internal to collectVersionRequirements ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The reason I did it this way was so I could unit test collectVersionRequirements without a image archive. Also imageLayoutHasIndex is used packageLayout.HasImageIndex()

return fmt.Errorf("failed to inspect package image layout: %w", err)
}
if hasImageIndex {
return nil
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

++ short-circuit validation. mental note for you mention of potentially checking for the desired target arch if we deemed necessary (not required).

@AustinAbro321 AustinAbro321 added this pull request to the merge queue May 27, 2026
Merged via the queue into main with commit 945a26d May 27, 2026
32 checks passed
@AustinAbro321 AustinAbro321 deleted the allow-index-sha-pulling branch May 27, 2026 15:43
@github-project-automation github-project-automation Bot moved this to Done in Zarf May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants