Skip to content

PKG-1427: GC leaked docker buildx builders on cloud.cd workers#371

Closed
nogueiraanderson wants to merge 3 commits into
mainfrom
PKG-1427-buildx-builder-gc
Closed

PKG-1427: GC leaked docker buildx builders on cloud.cd workers#371
nogueiraanderson wants to merge 3 commits into
mainfrom
PKG-1427-buildx-builder-gc

Conversation

@nogueiraanderson

@nogueiraanderson nogueiraanderson commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Bug

  • Pipelines run anonymous docker buildx create --use with no buildx rm; each run leaks a running buildkit container plus a named _state cache volume, both exempt from docker system prune, filling cloud.cd worker disks to 100% (builds then fail at image pull).

Fix

  • Hourly controller-side task removes anonymous buildx_buildkit_* containers older than 24h plus their volumes on idle docker-labelled workers, then age-bounded cache prunes.
  • All GC logic lives in dockerBuildxGc.sh (shellcheck-clean); the groovy is a thin scheduler that re-reads the payload each tick, so shell-side changes deploy via the S3/SSM sync alone.
  • Named shared builders (multiarch, multiarch-builder, multiarch-wt, pmmbuilder, from a fleet-wide audit of live-pinned pipeline sources) are protected: never removed, cache pruned only.
  • Idle gate re-checked at launch plus the 24h age filter protect in-flight builds; per-node and whole-sweep timeouts skip wedged agents; a generation token makes re-evaluation idempotent.

Tickets

- New init.groovy.d task: removes anonymous buildx_buildkit_* containers
  older than 24h plus their _state volumes on idle docker-labelled workers
- Protects named shared builders (multiarch, pmmbuilder); their cache is
  age-pruned instead of removed
- Engine build cache pruned with until=48h; no docker system prune
- Layered bounds: per-proc and per-node timeouts, whole-sweep deadline,
  overlap guard, generation token for idempotent re-evaluation
- All GC logic now lives in dockerBuildxGc.sh (shellcheck-clean);
  the groovy is a thin scheduler that re-reads the payload every tick,
  so shell-side changes deploy via the S3/SSM sync alone
- Widen cloud's init_groovy_files glob to *.{groovy,sh}; Jenkins only
  evaluates *.groovy, shipped .sh files are inert on the master
…t audit

- Audit covered inline/freestyle job definitions on all 10 masters (zero
  buildx hits), jenkins-pipelines master/hetzner/feature branches, and
  every live-pinned fork branch
- Adds multiarch-builder (hetzner branch: pmm rpm-build, rel valkey) and
  multiarch-wt (pmm-arm64-test branch) to the protect list
@nogueiraanderson
nogueiraanderson deleted the PKG-1427-buildx-builder-gc branch July 16, 2026 11:31
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.

1 participant