Repository navigation
fix(ci): record release SBOMs that name the image digest they describe - #13685
Merged
Merged
Conversation
## Failure The `v0.1.0-rc6` draft's 24 agent and proxy SBOMs don't name the image they describe. Each document's subject is `nc-fabric@sha256:...`, a digest that is neither the platform manifest it is stored under nor the image config: #13664 scanned the local image, and Syft names the copy Docker exports. Only the four runtime SBOMs, scanned from the registry, name their manifest digest. Their contents are right: rescanning five rc6 platforms from their release digests gave identical packages, files, and relationships. But a reader can't tell from a document which image it describes, and staging copied whatever `sbom-DIGEST` held without checking. ## Decision - `image-sbom.sh` scans the pushed platform manifest from the registry, so the document's subject is the digest it is stored under, and it refuses to record a document that names another one. - It reuses a recorded document only when that document names its digest; otherwise it scans again and replaces it. That replaces the rc6 records the next time each image is pushed or staged. - Staging calls the same script, with an output path, in place of its own copy-or-scan code. A scan there records its result, so a rerun reuses it. - The record is built for the image's platform, so staging can record an arm64 document from an amd64 runner. The first staging after this rescans the current agent and proxy images once, since their records name exported copies. Each image workflow push now pulls the pushed image to scan it; rescans of rc6 agent images from the registry took 16 to 30 s each on a workstation. The prune job needs no change: simulated on the package's current versions with 10 down to 1 kept commits, it never deletes an SBOM whose image it keeps, because a record is always pushed after its image. ## Validation - Against a local registry: the `origin/v1` script recorded a document naming another digest (RED). This script replaced it with one naming the stored digest, reused it from a digest reference with an output path, and recorded and reused an amd64 image's document from an arm64 host. - `shellcheck -s sh` is clean; `actionlint` reports the same findings as `origin/v1`. - Deferred to CI: the next image-affecting `v1` push records agent SBOMs through the registry, and the next release candidate's staging replaces the old records once and reuses them on a rerun. Signed-off-by: Carlos Villela <[email protected]>
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Failure
The
v0.1.0-rc6draft's 24 agent and proxy SBOMs don't name the image they describe. Each document's subject isnc-fabric@sha256:..., a digest that is neither the platform manifest it is stored under nor the image config: #13664 scanned the local image, and Syft names the copy Docker exports. Only the four runtime SBOMs, scanned from the registry, name their manifest digest. Their contents are right: rescanning five rc6 platforms from their release digests gave identical packages, files, and relationships. But a reader can't tell from a document which image it describes, and staging copied whateversbom-DIGESTheld without checking.Decision
image-sbom.shscans the pushed platform manifest from the registry, so the document's subject is the digest it is stored under, and it refuses to record a document that names another one.The first staging after this rescans the current agent and proxy images once, since their records name exported copies. Each image workflow push now pulls the pushed image to scan it; rescans of rc6 agent images from the registry took 16 to 30 s each on a workstation.
The prune job needs no change: simulated on the package's current versions with 10 down to 1 kept commits, it never deletes an SBOM whose image it keeps, because a record is always pushed after its image.
Validation
origin/v1script recorded a document naming another digest (RED). This script replaced it with one naming the stored digest, reused it from a digest reference with an output path, and recorded and reused an amd64 image's document from an arm64 host.shellcheck -s shis clean;actionlintreports the same findings asorigin/v1.v1push records agent SBOMs through the registry, and the next release candidate's staging replaces the old records once and reuses them on a rerun.