Skip to content

Disable build history when maxEntries is zero - #7038

Closed
CAOShurong wants to merge 1 commit into
moby:masterfrom
CAOShurong:codex/3798-disable-history-zero
Closed

Disable build history when maxEntries is zero#7038
CAOShurong wants to merge 1 commit into
moby:masterfrom
CAOShurong:codex/3798-disable-history-zero

Conversation

@CAOShurong

Copy link
Copy Markdown

Closes #3798.

What changed

  • Treat history.maxEntries = 0 as an explicit request to disable build history.
  • Bypass the recordBuildHistory path instead of creating START/COMPLETE records, provenance blobs, and trace data that GC deletes shortly afterward.
  • Keep the solver progress lifecycle closed for both successful and failed builds when history is disabled.
  • Document the zero-value behavior in the example buildkitd.toml.

Because the solver now bypasses recordBuildHistory entirely in this mode, the build-completion metrics currently emitted from that history finalizer are also disabled. This matches the issue's request to completely ignore the History API; if those metrics should remain independent of history, they can be separated from the history-record path in a follow-up.

Validation

  • go test -mod=vendor -buildvcs=false ./solver/llbsolver/history -count=1
  • go test -mod=vendor -buildvcs=false -vet=off ./solver/llbsolver -count=1
  • go vet -mod=vendor -buildvcs=false ./solver/llbsolver/history
  • go build -mod=vendor -buildvcs=false ./cmd/buildkitd ./cmd/buildctl
  • TESTPKGS=./client TESTFLAGS='--run /TestBuildHistoryDisabled -v' ./hack/test integration
    • Exercised successful and intentionally failed solves.
    • Confirmed neither ref was returned by ListenBuildHistory.
    • Passed on all 9 generated workers: OCI, rootless OCI, gVisor/tap/vsock/detached-netns OCI, stargz OCI, containerd, containerd 1.7, containerd 2.2, rootless containerd, and stargz containerd.

Broader go vet ./solver/llbsolver/... ./control ./client still reports three existing lost-cancel warnings in solver/llbsolver/export.go and solver/llbsolver/history.go; this change does not modify those call sites.

AI assistance

OpenAI Codex assisted with implementation and test development. I reviewed the resulting diff and ran the checks listed above.

Skip build-history recording entirely when history.maxEntries is explicitly set to zero, while still closing progress for normal builds. Cover successful and failed builds across the integration worker matrix and document the configuration.

Closes moby#3798.

Assisted-by: OpenAI Codex
Signed-off-by: Shurong Cao <170531907+CAOShurong@users.noreply.github.com>
@tonistiigi

Copy link
Copy Markdown
Member

replaced by #7040

@tonistiigi tonistiigi closed this Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add special handling for HistoryAPI maxentries=0

2 participants