Serialize shared CI target cache by product #54

Closed
opened 2026-10-01 10:31:13 +08:00 by Breadway · 2 comments
Owner

A Hestia runner check for Breadcloud PR #75 failed while simultaneous check and test jobs shared the same product target cache. The observed error was cp: cannot stat /cargo-target/./debug/deps/libbreadcloud_webdav-...rlib. ci/build.sh bind-mounts ${CACHE_ROOT}/target-${PRODUCT} into each container and copies it back into each checkout. A concurrent Cargo invocation can remove or replace an artifact during the copy. Hold a host lock per product across Docker build, run and target copy, while preserving cross-product parallelism and cache reuse. Verify with shell checks and concurrent invocations. Keep the fix in the shared script; separate ECO-28 tracks its vendored checkout race.

A Hestia runner check for Breadcloud PR #75 failed while simultaneous check and test jobs shared the same product target cache. The observed error was `cp: cannot stat /cargo-target/./debug/deps/libbreadcloud_webdav-...rlib`. `ci/build.sh` bind-mounts `${CACHE_ROOT}/target-${PRODUCT}` into each container and copies it back into each checkout. A concurrent Cargo invocation can remove or replace an artifact during the copy. Hold a host lock per product across Docker build, run and target copy, while preserving cross-product parallelism and cache reuse. Verify with shell checks and concurrent invocations. Keep the fix in the shared script; separate ECO-28 tracks its vendored checkout race.
Author
Owner

Implemented a fail-closed per-product lock requirement and added a mocked-Docker concurrency regression check to CI. The check confirms same-product invocations serialize while different products overlap. Local verification passes. PR: #55. Forgejo CI is running.

Implemented a fail-closed per-product lock requirement and added a mocked-Docker concurrency regression check to CI. The check confirms same-product invocations serialize while different products overlap. Local verification passes. PR: https://git.breadway.dev/Breadway/bread-ecosystem/pulls/55. Forgejo CI is running.
Author
Owner

Independent review verdict

Acceptance mapping for PR #55 at 656123e6e942702c3187f7e4fa348a765e39a687:

  1. Same-product builds serialize on ${CACHE_ROOT}/target-${PRODUCT}.lock, held from before Docker build until Docker run and the target copy complete: ci/build.sh:73-91,93-141.
  2. Different products use different lock paths and remain concurrent: ci/build.sh:84; ci/test-build-lock.sh:70-79 asserts overlapping mock runs for separate products.
  3. Missing flock fails before Docker or Cargo touches the target cache: ci/build.sh:80-83. Docker/build failures propagate under set -e, and the shell releases the lock when the script exits.
  4. The same-product concurrency regression test and cross-product concurrency test are committed and run in CI: ci/test-build-lock.sh:58-81, .forgejo/workflows/check.yml:41.

Forgejo CI is successful for this exact head, and the PR is mergeable. The lock scope and test behavior are correct by inspection. bread-ecosystem is release-sensitive, so I leave the merge to the maintainer.

## Independent review verdict Acceptance mapping for PR #55 at `656123e6e942702c3187f7e4fa348a765e39a687`: 1. Same-product builds serialize on `${CACHE_ROOT}/target-${PRODUCT}.lock`, held from before Docker build until Docker run and the target copy complete: `ci/build.sh:73-91,93-141`. 2. Different products use different lock paths and remain concurrent: `ci/build.sh:84`; `ci/test-build-lock.sh:70-79` asserts overlapping mock runs for separate products. 3. Missing `flock` fails before Docker or Cargo touches the target cache: `ci/build.sh:80-83`. Docker/build failures propagate under `set -e`, and the shell releases the lock when the script exits. 4. The same-product concurrency regression test and cross-product concurrency test are committed and run in CI: `ci/test-build-lock.sh:58-81`, `.forgejo/workflows/check.yml:41`. Forgejo CI is successful for this exact head, and the PR is mergeable. The lock scope and test behavior are correct by inspection. `bread-ecosystem` is release-sensitive, so I leave the merge to the maintainer.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Breadway/bread-ecosystem#54
No description provided.