Skip to content

feat: expose sbom generation tools - #4795

Open
a1994sc wants to merge 4 commits into
mainfrom
feature/allen/api-expose
Open

feat: expose sbom generation tools#4795
a1994sc wants to merge 4 commits into
mainfrom
feature/allen/api-expose

Conversation

@a1994sc

@a1994sc a1994sc commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Description

Exposes a handful of useful generic functions from github.com/zarf-dev/zarf/src/pkg/packager/layout

Related Issue

Fixes #4794

Checklist before merging

@a1994sc
a1994sc requested review from a team as code owners April 7, 2026 21:04
@netlify

netlify Bot commented Apr 7, 2026

Copy link
Copy Markdown

Deploy Preview for zarf-docs ready!

Name Link
🔨 Latest commit 795818b
🔍 Latest deploy log https://app.netlify.com/projects/zarf-docs/deploys/69f14b4499c96a00082e00ec
😎 Deploy Preview https://deploy-preview-4795--zarf-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented Apr 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/pkg/packager/layout/sbom.go 50.00% 1 Missing ⚠️
Files with missing lines Coverage Δ
src/pkg/packager/layout/assemble.go 43.26% <100.00%> (ø)
src/pkg/packager/layout/sbom.go 48.21% <50.00%> (ø)
🚀 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.

a1994sc added 2 commits April 7, 2026 18:45
Signed-off-by: Allen Conlon <software@conlon.dev>
Signed-off-by: Allen Conlon <software@conlon.dev>
@a1994sc
a1994sc force-pushed the feature/allen/api-expose branch from 125ccb9 to 9e00b02 Compare April 7, 2026 22:45
@a1994sc

a1994sc commented Apr 7, 2026

Copy link
Copy Markdown
Contributor Author

A little unsure about the comments for the functions that I exposed, so if someone can double check them please and thank you.

@brandtkeller brandtkeller left a comment

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.

Slight changes to the doccomments.

I have some reservations:

Things like the signatures. They were okay as non-exported functions but some of the behaviors as public API's are a little "leaky" IMO.

I would also question the package origin. Do these really make quality exported functions for the layout package?

Not inherently against making these public but do want to play devils advocate. Any additional surfaces we expose get locked in during v1.0.0 and create more surface areas for vulnerabilities.

Tagging @zarf-dev/maintainers to weigh in as well.

}

func getChecksum(dirPath string) (string, string, error) {
// GetChecksum takes a directory then creates a sha256 check sum for each files in the

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.

a small improvement might be explicitly mentioning the return values.

}

func createImageSBOM(ctx context.Context, cachePath, outputPath string, img v1.Image, src string) ([]byte, error) {
// CreateImageSBOM is used to generate a syft SBOM for a provided image reference.

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.

This function is a bit "leaky" with regards to how it operates - returning both the bytes AND writing the file to the filesystem. Acceptable perhaps as a private function but supported in our public API's....

Nonetheless we should doccomment the behaviors.

@github-project-automation github-project-automation Bot moved this to In progress in Zarf Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

Expose some useful sbom and tar related functions.

2 participants