Skip to content

Creating an sbom file (cyclonedx 1.7) during image build process.#145

Open
commel wants to merge 1 commit intomainfrom
add-cyclone-sbom
Open

Creating an sbom file (cyclonedx 1.7) during image build process.#145
commel wants to merge 1 commit intomainfrom
add-cyclone-sbom

Conversation

@commel
Copy link
Copy Markdown

@commel commel commented Apr 27, 2026

What this PR does / why we need it:
This adds SBOM generation in CycloneDX 1.7 format during image build.

Which issue(s) this PR fixes:
Fixes gardenlinux/glvd2#7

Using the fields from dpkg-query to format the available data. No library is used to keep this script lean.

Not part of this PR: Uploading the SBOM artefact in Github Actions.

Reviewer: you can use cyclonedx-cli to validate the file.

On-behalf-of: SAP b.ritter@sap.com

@commel commel self-assigned this Apr 27, 2026
Comment thread builder/image.manifest Fixed
Comment thread builder/image.manifest Fixed
Comment thread builder/image.manifest Fixed
Comment thread builder/image.manifest Fixed
@commel commel added this to the 2026-04 milestone Apr 27, 2026
@commel commel marked this pull request as ready for review April 28, 2026 07:37
@commel commel requested review from gehoern and nkraetzschmar April 28, 2026 07:38
Comment thread builder/image.manifest Outdated

# build cyclonedx sbom
#shellcheck disable=SC2016
chroot "$chroot_dir" dpkg-query --show --showformat='${binary:Package}\t${Version}\t${Architecture}\t${Homepage}\t${Maintainer}\t${source:Package}\t${source:Version}\n' > "$2.dpkg.csv"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Doing > "$2.dpkg.csv" might work but breaks the interface of how builder image scripts are supposed to work. They should only output to $2 and not assume that other files next to $2 are accessible.

Else the *.manifest.dpkg.csv will not correctly appear in the artifacts list (this will only contain *.manifest) so it may not get picked up by downstream tools.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for the input. After a closer look I moved the sbom creation to a solitary script. Does this fit better?

Comment thread builder/image.manifest Outdated
Comment thread builder/image.sbom Fixed
refs gardenlinux/glvd2#7

Signed-off-by: Bernd Ritter <ritter@b1-systems.de>
On-behalf-of: SAP <b.ritter@sap.com>
@commel commel force-pushed the add-cyclone-sbom branch from c609c06 to 3cee8d9 Compare May 6, 2026 12:03
@commel commel requested a review from nkraetzschmar May 6, 2026 12:08
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.

SBOM creation into GL builder

3 participants