Skip to content

fix(build): honor provenance/sbom false in per-service bake attest - #14112

Open
glours wants to merge 1 commit into
docker:mainfrom
glours:fix/bake-provenance-false
Open

fix(build): honor provenance/sbom false in per-service bake attest#14112
glours wants to merge 1 commit into
docker:mainfrom
glours:fix/bake-provenance-false

Conversation

@glours

@glours glours commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

What I did
When a service set build.provenance: false (or sbom: false), the bake attest entry was silently omitted (the field is omitempty), so BuildKit applied its defaults and attached a provenance attestation anyway. The attestation changes the manifest-list digest on every build, which caused containers to be needlessly recreated on up --build.

Emit "type=<t>,disabled=true" instead, which BuildKit's Attest.UnmarshalText parses as Disabled:true and forwards to BuildKit as an explicit disable signal.

Extract appendAttest to avoid duplicating the three-branch switch for both provenance and sbom.

Related issue

Fixes #14111

(not mandatory) A picture of a cute animal, if possible in relation to what you did

When a service set `build.provenance: false` (or `sbom: false`), the
bake attest entry was silently omitted (the field is `omitempty`),
so BuildKit applied its defaults and attached a provenance attestation
anyway. The attestation changes the manifest-list digest on every build,
which caused containers to be needlessly recreated on `up --build`.

Emit `"type=<t>,disabled=true"` instead, which BuildKit's
`Attest.UnmarshalText` parses as `Disabled:true` and forwards to
BuildKit as an explicit disable signal.

Extract `appendAttest` to avoid duplicating the three-branch switch
for both provenance and sbom.

Fixes docker#14111

Signed-off-by: Guillaume Lours <glours@users.noreply.github.com>
@glours
glours requested review from a team as code owners August 20, 2026 19:10
@glours
glours requested a review from ndeloof August 20, 2026 19:10
@glours glours self-assigned this Aug 20, 2026

@docker-agent docker-agent left a comment

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.

Assessment: 🟢 APPROVE

The refactor is correct and complete. The new appendAttest helper cleanly handles all four value branches ("", "true", "false", and user-supplied strings), and the "type=<t>,disabled=true" format is the correct signal for BuildKit's Attest.UnmarshalText to set Disabled: true. No behavioral regressions from the extraction — both provenance and sbom code paths are now symmetric and the test suite covers the key cases including the previously-broken false branch.

@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

build.provenance: false is ignored with the containerd image store; up --build recreates unchanged containers

2 participants