feat(ci): ship host-derived buildkit defaults into runners - #66
Merged
Conversation
BuildKit's docker-container driver reads none of the host daemon's configuration, and its snapshotter auto-probe is overlayfs-or-native — it never tries fuse-overlayfs. On hosts whose kernel lacks overlayfs (Synology DSM) builds therefore silently get the copy-less native snapshotter (~10x slower), and plain-HTTP registries need a hand-written buildkitd-config-inline stanza in every consuming workflow. - Generate a default buildkitd.default.toml per reconcile pass (CiBuildkitConfig): [registry] http/insecure stanzas for exactly the registries the daemon itself treats as insecure (GET /info), plus a [worker.oci] snapshotter that is auto-detected from the host by default — fuse-overlayfs exactly where the kernel lacks overlayfs but has FUSE (probed on the NAS: an explicit fuse-overlayfs worker starts cleanly there), nothing anywhere else. The instance-wide Ci:BuildkitSnapshotter option overrides (auto | none | a name). - Deliver it via a third per-repo volume mounted at /home/runner/_buildx and exported as BUILDX_CONFIG, so every docker/setup-buildx-action inherits it with no workflow change; a volume rather than a file bind because dockerd creates bind parents root-owned (the _work trap). The volume-init container writes the file and re-runs on content change, converging every pass so runtime registry changes reach busy repos. - Bump the runner spec-hash material so pre-existing idle runners are recycled once and pick up the new mount and env. - Add a reusable build-push-image.yml workflow encoding the docker driver fast path (real CoW via the host storage driver, persistent daemon cache, provenance off), reading the REGISTRY variable/secrets Watchtower already syncs. - Document the mechanism, the DSM probe result, and the operational notes (builder prune, gzip-bound export) in the CI runners design doc and ADR-0028; index the missing ADR-0027 line. Closes #65
This was referenced Aug 28, 2026
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.
Closes #65.
What changed
BuildKit's
docker-containerdriver (the documentedsetup-buildx-actiondefault) reads none of the host daemon's configuration, and its snapshotter auto-probe is overlayfs-or-native— it never tries fuse-overlayfs on its own. On DSM's 4.4 kernel that means every build silently gets the copy-lessnativesnapshotter (~10× slower; a fully-cached MuxBox publish spent 13m20s with nothing to upload), and the plain-HTTP registry needs a hand-writtenbuildkitd-config-inlinestanza in every consuming workflow. Both are host facts that belong in Watchtower, not in repos.Proposal A — a generated default buildkitd config in every runner
CiBuildkitConfiggeneratesbuildkitd.default.tomleach reconcile pass:[registry."…"] http/insecure = truefor exactly the registries the daemon itself marks insecure (GET /info→RegistryConfig.IndexConfigs) — no new Watchtower state, tracks the host automatically, deletesbuildkitd-config-inlinefrom consuming workflows.[worker.oci] snapshotter, auto-detected by default:fuse-overlayfsexactly where the kernel lacks overlayfs but has FUSE (read from/proc/filesystems, kernel-global even from a container; an overlay-family storage driver also counts as proof), nothing anywhere else. The new instance-wideCi:BuildkitSnapshotteroption overrides:auto|none| explicit name./home/runner/_buildx, exported asBUILDX_CONFIG, so everysetup-buildx-actioninherits it with zero workflow changes (a workflow's ownbuildkitd-config(-inline)still wins). A volume rather than a file bind on purpose — dockerd creates bind parents root-owned (the_worktrap; a mount under~/.dockerwould break the nextdocker login). The existing volume-init container writes the file (content via env,printf '%s') and re-runs on content change, converging every pass so runtime registry changes reach repos whose slots are all busy.Proposal B — the fast path as one
uses:line.github/workflows/build-push-image.yml(reusable) encodes the docker-driver build for hosts where the container driver is the wrong tool: no buildx builder → the daemon's own builder (real CoW via the host storage driver, cache persists across ephemeral runners,insecure-registriesinherited natively),provenance: false, reading theREGISTRYvariable/secrets Watchtower already syncs. Consumers:uses: swimmesberger/Watchtower/.github/workflows/build-push-image.yml@main+secrets: inherit.Docs
New "Container image builds" section in
docs/ci-runners/design.mdand ADR-0028, including the probe procedure and its NAS result, and the operational notes from the issue (docker builder pruneas future maintenance work;exporting layersis gzip-bound — not a second bug). Also indexed the missing ADR-0027 line in the decisions README.The open question — answered
The issue asked whether any OCI snapshotter can work on DSM. The probe was run on the NAS (2026-08-28): FUSE present,
/dev/fusepresent, andmoby/buildkit --oci-worker-snapshotter=fuse-overlayfsstarts cleanly with a registered fuse-overlayfs worker. So thenativefallback is purely BuildKit's probe never attempting fuse-overlayfs — exactly the gap the auto-detection fills. After merge + deploy, the NAS needs no configuration at all;Ci:BuildkitSnapshotter=noneis the escape hatch if a host's FUSE misbehaves in a real build.Reviewer notes
GET /infois called once per reconcile pass and only when at least one CI repo exists.Ci:BuildkitSnapshottervalues warn once per distinct value and fall back to detection; the resolved choice is logged once on change.CiBuildkitConfigTests(TOML shape, host-detection matrix incl. a DSM-verbatim/proc/filesystemsfixture and thefuseblk≠fusetrap) and extendedCiRunnerContainerSpecTests(buildx mount/env, the~/.dockertrap guard, volume-init writes the config without splicing it into the script). Full suites: 1877 + 339 passing.