Repository navigation
feat(buildkitdrive): mirror ghcr.io to a local registry (the base-input half) - #428
Conversation
The drive builds each stage with BuildKit and bridges the OUTPUT into the run
engine's store (LoadExport). The INPUT half is missing: buildkitd's store is
disjoint from the engine's, so a child stage's FROM an internal base is resolved
by the daemon's registry resolver and fails (403) when that base was built in the
same run rather than published.
DaemonOptions.RegistryMirror renders:
[registry."ghcr.io"]
mirrors = ["<local>"]
[registry."<local>"]
http = true
MEASURED (buildkitd 0.34.0, registry:2 on 127.0.0.1:5000): two other forms FAIL
silently -- the mirror key MUST be the registry HOST (a host+namespace key such as
[registry."ghcr.io/opencharly"] is ignored and the resolve still goes upstream),
and a plain-HTTP mirror needs its own http = true stanza. With both rendered,
'FROM ghcr.io/opencharly/spike-base:test' resolved from the local registry and the
build completed with no ghcr query.
Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)
Review — BLOCKHead SHA: Change class: Go library (sdk Blocks
Notes (non-blocking, rulebook gaps — do not gate on these)
No comments on the thread to disposition (0 comments). Attribution footer is present in the correct form and the Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
Review noted the check was global: a stray "http = true" anywhere in the rendered config could satisfy it. The requirement is that the MIRROR HOST's own stanza carries it, so the assertion now matches the stanza text itself. Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)
Review — BLOCKHead SHA: Change class: Go library ( Security screen: PASS — additive option field + test; no scope mismatch, no secrets/egress, no guardrail or dependency change. The diff does exactly what the body says. Comment dispositions
Blocks
Non-blocking notes (rulebook gaps — do not gate on these)
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
Review — BLOCKHead SHA: Change class: Go library ( Security screen: PASS — additive Blocks
Comment dispositions
Placement: CORRECT — Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
Review — PASSHead SHA: Security screen: PASS — additive Comment dispositions
Non-blocking (rulebook gaps)
Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
…the base-input half) (#33) * feat(build): push each built image to the local charly OCI registry The drive bridged only the OUTPUT of a build into the run engine's store; a base image built earlier in the same run was therefore invisible to buildkitd, whose resolver went upstream and got 403 for an internal tag. - driveConfig.RegistryMirror, resolved from CHARLY_BUILD_REGISTRY_MIRROR. - buildImage passes it to buildkitdrive.Ensure (sdk#428 renders the mirror) and additionally pushes the built image to that registry under the SAME FullTag via localRegistryRef, so the next stage's FROM resolves locally. - registry.go: the drive OWNS the registry lifecycle (reuse a /v2/ responder, else start registry:2 on the mirror's host:port and wait, bounded, for readiness), so a correct build never depends on out-of-band setup. Measured end-to-end through this drive: arch and arch-builder built rc=0, with arch-builder's FROM ghcr.io/opencharly/arch:<calver> resolving from the local registry instead of 403ing against ghcr. Requires opencharly/sdk#428; the sdk pin is bumped once that tags. Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system) * feat(build): pin sdk v0.2026293.417 for the local-registry mirror opencharly/sdk#428 landed DaemonOptions.RegistryMirror (tagged v0.2026293.417), so this branch now compiles against a published sdk instead of a local replace: the mirror stanza, the push to the mirror under the same FullTag, and the drive-owned registry lifecycle all build and vet clean. Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system) * fix(build): address the review of the local-registry mirror - the registry is started through the CONFIGURED run engine (container.EngineBinary(c.RunEngine)), not a hardcoded podman: the drive resolves RunEngine precisely so the operator's engine choice is honoured. - every bound is a named constant (registryProbeTimeout, registryReadyWindow, registryReadyPoll, registryContainerPort, registryImage) instead of inline literals. - registry.go documents the deliberate `run --replace`: the name is deterministic, so a leftover container from an interrupted run must not block the next build, and nothing else is expected to own that name. - NEW registry_test.go: localRegistryRef's path mapping (three shapes, and the prefix invariant), registryAnswers against a live httptest server (200 and 401 accepted, 404 and a closed port rejected), and ensureLocalRegistry's two edge contracts (empty mirror is a no-op; a mirror without host:port is rejected by name). go build ./... clean; go test ./... ok. Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system) * fix(build): make the registry lifecycle portable across engines `podman run --replace` is a podman-only flag, so the "configured container backend" claim was not true for docker/nerdctl. The leftover container of the deterministic name is now removed first with the portable `<engine> rm -f <name>` (a "no such container" exit is expected and ignored), and the run itself carries no engine-specific flag. go build ./... and go test ./... clean. Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system) --------- Co-authored-by: charly <[email protected]>
charly now requires the published, tagged halves this work depends on: plugin-build/candy/plugin-build v2026.293.0443 (opencharly/plugin-build#33) sdk v0.2026293.417 (opencharly/sdk#428) With those pins the drive renders the buildkitd registry mirror and pushes each built image to the local OCI registry, and the call-bound knobs in this branch let a long image build finish. Measured together: R10 check-strata-gpu-pod ok:true on a stamped binary (50/0/6, 0 x 403 image build). Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)
* fix(plugin): make the host→plugin call bounds configurable A long-running operation dispatched as a host→plugin call cannot exceed pluginLeafCapDefault (10 minutes), and is cancelled earlier if it shows no host-visible progress — neither bound is settable, so a real image build is impossible on any host whose build takes longer than ten minutes. Measured, repeatedly, building the strata image (3 GB CUDA/cuDNN retrieval + 6.7 GB install): buildkitd.log: rpc error: code = Canceled desc = context canceled buildctl: signal: killed (charly exits 1) and after raising the cap alone, the same shape at the no-progress window while the package install ran INSIDE buildkitd — a build's work happens in the daemon's process tree, not the plugin's descendants, so the watchdog sees silence. Both bounds are per-venue operational limits, not product constants: CHARLY_PLUGIN_LEAF_CAP total-duration bound for one host→plugin call (default 10m) CHARLY_PLUGIN_NO_PROGRESS no-host-visible-progress window (default: readiness config) With both set, the R10 bed check-strata-gpu-pod builds the strata image in 1086 s and passes 14/14 steps (layer-strata#10) — impossible before this change. Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated) * build: pin the landed call-bound and mirror dependencies charly now requires the published, tagged halves this work depends on: plugin-build/candy/plugin-build v2026.293.0443 (opencharly/plugin-build#33) sdk v0.2026293.417 (opencharly/sdk#428) With those pins the drive renders the buildkitd registry mirror and pushes each built image to the local OCI registry, and the call-bound knobs in this branch let a long image build finish. Measured together: R10 check-strata-gpu-pod ok:true on a stamped binary (50/0/6, 0 x 403 image build). Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated) * fix(plugin): make the call-bound env parsing testable and prove it is consumed The overrides were written in init() straight from os.Getenv, so nothing could test the parsing and the review could not see that the dispatch path reads them. - applyCallBoundEnv(getenv) owns the parsing; init() is one line wiring os.Getenv. - NEW plugin_activity_bounds_test.go asserts the CONSUMERS (pluginLeafCap(), pluginInvokeNoProgress()) return the overrides, that a malformed or absent value leaves the shipped default standing (never a zero bound), and that the default is still 10m -- operators opt in, the binary keeps its previous behaviour. go build ./... clean; the three tests pass. Assisted-by: DeepSeek Harness deepseek-v4.1-flash (syntax check only) * fix(plugin): say so when a call-bound env value is malformed Review note: the parser silently discarded a malformed non-empty value, so a typo'd deployment (CHARLY_PLUGIN_LEAF_CAP=120x) ran with the shipped default and no signal at all -- indistinguishable from never setting it. applyCallBoundEnv now walks both knobs through one table, parses, and on a parse error writes a one-line warning to stderr and keeps the default. The behaviour (default preserved) is unchanged; the silence is not. go build ./... and the call-bound tests pass. Assisted-by: DeepSeek Harness deepseek-v4.1-flash (syntax check only) --------- Co-authored-by: charly <[email protected]>
Summary
Adds the input half of the local-build bridge.
buildkitdrivealready bridges each built image's output into the run engine's store (LoadExport); nothing made a locally built image resolvable to buildkitd for the next stage'sFROM.DaemonOptions.RegistryMirrorrenders:Why the exact shape matters (measured, not guessed)
Two other forms fail silently — the daemon ignores them and resolves upstream, which is why this took a while to attribute:
[registry."ghcr.io/opencharly"] mirrors = [...]https://ghcr.io/token...→ 403[registry."127.0.0.1:5000"] http = true[registry."ghcr.io"] mirrors = [...]+[registry."127.0.0.1:5000"] http = truehttp = truestanza.How tested
Spike, rootless
buildkitd 0.34.0,registry:2on127.0.0.1:5000, the image seeded as127.0.0.1:5000/opencharly/spike-base:test:End-to-end through a development build of the consumer (plugin-build compiled against this sdk;
go buildfrom the charly worktree, not CalVer-stamped), buildingarchthenarch-builder:with
arch:<calver>present in127.0.0.1:5000/opencharly/arch.Unit coverage:
TestDaemonConfig_CarriesTheRegistryMirrorasserts all three measured facts (host key present, host+namespace key absent, and the mirror host's own stanza carryinghttp = true— scoped to that stanza so a stray match elsewhere cannot satisfy it) and fails against the old rendering.go test ./buildkitdrive/ok;goand all four cross-compile jobs green.Rulebook compliance
goandpluginskills were loaded before touching the sdk; the build path is a plugin/SDK surface.DaemonConfig) owns the emitted TOML; no second writer.main.buildkitd.tomlthe daemon reads, plus the resolver behaviour it produces.opencharly/charly#985.opencharly/charly#985rather than deferred silently.DaemonConfigis a pure string renderer with no goroutines, shared state or ordering; the daemon's existingEnsurepath is untouched. CONC(b) — the one deferral (the stamped consumer bed) is filed, see Filed issues.disposable:target is created, mutated or destroyed; this PR changes a config renderer only.Empty
RegistryMirrorrenders no registry stanza, so existing behaviour is byte-identical.Filed issues
opencharly/charly#985— Prove the local-registry mirror end-to-end on a stamped binary. The CalVer-stamped consumer run this PR cannot perform (it needs the pins to move first), with the exact acceptance criteria and the related issues (charly#937,charly#984).Change classification
Go library (sdk
buildkitdrive), additive. Attribution tier: analysed on a live system (pasted spike + a development-build drive run; no stamped-binary R10 claimed).Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)