diff --git a/scripts/ci/run-windev-ci.sh b/scripts/ci/run-windev-ci.sh index 7d52fff..08b1072 100755 --- a/scripts/ci/run-windev-ci.sh +++ b/scripts/ci/run-windev-ci.sh @@ -80,16 +80,42 @@ fi echo "run-windev-ci: mode=$MODE sha=$CI_SHA target=${WINDEV_SSH_USER}@${WINDEV_SSH_HOST}" # Remote PowerShell bootstrap: fetch + checkout enough to load the versioned CI script, then -# hand off to it. Not Stop around git (stderr progress). windev-worker-ci.ps1 re-fetches and -# re-checks-out under a lock, so this checkout only needs to load the right script version. +# hand off to it. Not Stop around git (stderr progress). +# +# The bootstrap fetch/checkout mutates the shared clone's git index, so it MUST hold the +# worktree lock — otherwise two concurrent runs collide on .git/index.lock before either +# reaches windev-worker-ci.ps1's lock (the exact race the lock exists to prevent). We take the +# same mkdir lock here (atomic; retry to a 20-min deadline) and export MXGW_CI_LOCK_HELD so the +# handed-off script re-uses this lock instead of re-acquiring/releasing it. A standalone/manual +# run of windev-worker-ci.ps1 (degraded mode) has no such env and self-locks as before. read -r -d '' BOOTSTRAP <