fix(ci): per-target locked cargo cache mounts for the desktop/web builds (VAPP-59) #67
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/VAPP-59-desktop-cargo-cache-race"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Fixes VAPP-59: the
build-desktop-windowsrun on main (#344) failed unpackingbase16 v0.2.1withfailed to open .../base16-0.2.1/.cargo-ok: File exists (os error 17). That is a half-written crate dir in the shared cargo registry cache, not a defect in the repo source.Root cause
The desktop-linux, desktop-windows, and web image builds all trigger
on: push: branches: mainand can run concurrently on the same buildkit instance. EachRUNused a bare--mount=type=cache,target=/usr/local/cargo/registry, whose cache id defaults to just the target path. So the concurrent builds unpacked crates into the SAME registry cache and raced - one build leftbase16partially unpacked (dir present,.cargo-oknot yet written), and another then failed trying to create.cargo-ok.Fix
In all three Dockerfiles (
ci-build/Dockerfile.desktop-windows,Dockerfile.desktop-linux,Dockerfile.web):vervain-app-cargo-registry-{windows,linux,web}and the matching-gitids - so the builds no longer share the registry cache and cannot race each other on unpack.sharing=lockedso any two runs that DO share an id (e.g. two pushes to the same target) serialise the unpack instead of racing.The new ids also start from a clean cache, so they sidestep the already-corrupted shared mount that failed run #344 - no manual cache prune on the runner is needed.
Verification
x86_64-pc-windows-gnucross-compile viadocker buildx build -f ci-build/Dockerfile.desktop-windows .): completes successfully, produces thevervain-app.exeartifact, no.cargo-okerror.docker build --check(no warnings).Note
This was triaged
human_action(clear the corrupted cache + re-run), but the same race would recur on the next concurrent push. This change removes the race at the source, so the cache fix is permanent rather than a one-off prune.#VAPP-59
The build-desktop-windows run on main failed unpacking `base16 v0.2.1` with `.cargo-ok: File exists (os error 17)` - a half-written crate dir in the shared cargo registry cache, not a source defect. Root cause: the desktop-linux, desktop-windows, and web image builds all trigger on a push to main and can run concurrently on the same buildkit instance. Each used a bare `--mount=type=cache,target=/usr/local/cargo/registry`, which defaults to a cache id keyed only on the target path, so the concurrent builds unpacked crates into the SAME registry cache and raced. Give each build target its own cache id (`vervain-app-cargo-registry-{linux,windows,web}` and the matching git ids) so the builds no longer share the registry, and add `sharing=locked` so any same-id concurrent run serialises its unpack instead of racing itself. The new ids also start from a clean cache, so they sidestep the already-corrupted shared mount that failed run #344. Verified by building the windows desktop image locally with the patched Dockerfile (full x86_64-pc-windows-gnu cross-compile): the build completes and produces the `vervain-app.exe` artifact, with no `.cargo-ok` error. All three Dockerfiles pass `docker build --check`. #VAPP-59 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>