Serialize Gradle containers sharing a cache volume
All checks were successful
review/code-claude Approve: lock held across container, no deadlock, releases on all exits

This commit is contained in:
justinzeus 2026-10-27 15:30:44 +01:00
parent 761a5a6145
commit 221f623c87
2 changed files with 17 additions and 1 deletions

View file

@ -8,6 +8,12 @@ git_common=$(git rev-parse --path-format=absolute --git-common-dir)
image=${WOLFSKIN_BUILD_IMAGE:-wolfskin-build:sdk37-jdk21}
cache=${WOLFSKIN_GRADLE_VOLUME:-wolfskin-gradle}
secrets=${WOLFSKIN_SECRETS_DIR:-/opt/stacks/ventoy/machine-parity/manifest-tank/secrets/wolfskin}
lock=${WOLFSKIN_GRADLE_LOCK_FILE:-/var/tmp/${cache}.gradle.lock}
exec {lock_fd}>"$lock"
if ! flock --exclusive --nonblock "$lock_fd"; then
printf 'Waiting for Gradle cache lock: %s\n' "$lock" >&2
flock --exclusive "$lock_fd"
fi
arguments=(--rm --platform linux/amd64 --user "$(id -u):$(id -g)"
--mount "type=bind,src=$root,dst=$root" --workdir "$root"
--mount "type=volume,src=$cache,dst=/gradle"