Skip to content

fix(cache): sbom cachepath existence#4762

Merged
brandtkeller merged 2 commits intomainfrom
4735_image_cache
Mar 31, 2026
Merged

fix(cache): sbom cachepath existence#4762
brandtkeller merged 2 commits intomainfrom
4735_image_cache

Conversation

@brandtkeller
Copy link
Copy Markdown
Member

@brandtkeller brandtkeller commented Mar 30, 2026

Description

The {cache}/images directory is only created as a side effect of images.Pull(). When a package uses imageArchives instead of pulling from a registry, componentImages is empty, Pull() is never called, and nobody creates that directory. But createImageSBOM runs unconditionally (unless SBOM is skipped) and passes filepath.Join(cachePath, ImagesDir) to stereoscope, which assumes it exists and fails when it tries to write uncompressed layer data into it via os.Create.

This PR was specifically scoped to the identified issue. I think there is room for evaluating common entrypoints for library defaults.

Related Issue

Fixes #4735

Relates to #

Checklist before merging

Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 30, 2026

Deploy Preview for zarf-docs canceled.

Name Link
🔨 Latest commit 6098a6a
🔍 Latest deploy log https://app.netlify.com/projects/zarf-docs/deploys/69cab5511f8015000892ae08

Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 30, 2026

Codecov Report

❌ Patch coverage is 25.00000% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/pkg/packager/layout/sbom.go 25.00% 2 Missing and 1 partial ⚠️
Files with missing lines Coverage Δ
src/pkg/packager/layout/sbom.go 48.21% <25.00%> (-0.34%) ⬇️
🚀 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.

@brandtkeller brandtkeller marked this pull request as ready for review March 30, 2026 17:54
@brandtkeller brandtkeller requested review from a team as code owners March 30, 2026 17:54
@brandtkeller brandtkeller changed the title fix(cache): image archive cachepath existence fix(cache): sbom cachepath existence Mar 30, 2026
Copy link
Copy Markdown
Contributor

@soltysh soltysh left a comment

Choose a reason for hiding this comment

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

lgtm

@brandtkeller brandtkeller added this pull request to the merge queue Mar 31, 2026
Merged via the queue into main with commit 8785473 Mar 31, 2026
35 checks passed
@brandtkeller brandtkeller deleted the 4735_image_cache branch March 31, 2026 18:52
@github-project-automation github-project-automation Bot moved this to Done in Zarf Mar 31, 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.

~/.zarf-cache/images does not automatically get created

2 participants