fix(ci): serialize Gradle cache mounts with sharing=locked (repair post-merge API build) #1001
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/gradle-cache-lock"
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?
Problem
Post-merge run 3528 for PR #1000 failed at Build API image:
gradle :apps:api:dependenciesdied with "Timeout waiting to connect to the Gradle daemon" +FileLockContentionHandlerexceptions. Deploy API was skipped, so the API still runs the pre-merge image.Root cause (timeline-proven):
apps/api/Dockerfileandapps/worker-media/Dockerfileshare cache idmemories-gradle-cacheas their entireGRADLE_USER_HOME(daemon registry + file locks).build.gradle.ktschange in #1000 invalidated both images' gradle layers at once → both jobs launched Gradle 0.3s apart (09:41:45.9 / 09:41:46.2) in separate network namespaces on one shared daemon registry → API timed out, media worker won.Fix
Add
sharing=lockedto all four Gradle cache mounts: BuildKit serializes every step using that cache id across all builds on the daemon, so exactly one Gradle process ownsGRADLE_USER_HOMEat a time, while dependency caching stays shared (no cache duplication).Verification
docker buildof both images viadocker:28-cli+ BuildKit (the CI execution path) with the fixed Dockerfiles: both exit 0 (gradledependencies+bootJarexecuted for each).apps/api/**,apps/worker-media/**) re-triggers exactly the failed jobs on merge: Build API image → Deploy API (+ media worker rebuild/redeploy).