Skip to content

Commit 0821ae6

Browse files
committed
fix(deploy): add concurrency control to prevent parallel deploys
Root cause: two CI runs complete near-simultaneously, triggering two deploy workflows. Second deploy's 'rm -rf .next' kills first's build. Fixes: - GitHub Actions concurrency group (cancel-in-progress: true) - Server-side flock to prevent concurrent builds on the droplet
1 parent c543306 commit 0821ae6

18 files changed

Lines changed: 11 additions & 1 deletion

.github/workflows/deploy-droplet.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ on:
1515
branches: [main, master]
1616
workflow_dispatch: # Allow manual trigger
1717

18+
concurrency:
19+
group: deploy-droplet
20+
cancel-in-progress: true
21+
1822
env:
1923
# Deploy path: /home/ubuntu/www/:domain/:repo
2024
DEPLOY_PATH: /home/ubuntu/www/bittorrented.com/media-streamer
@@ -116,7 +120,11 @@ jobs:
116120
117121
echo ""
118122
echo "=== Cleaning build cache ==="
119-
# Kill any lingering next build processes to avoid lock conflicts
123+
# Acquire exclusive lock to prevent concurrent deploys on server
124+
exec 200>/tmp/deploy-build.lock
125+
flock -n 200 || { echo "✗ Another deploy is running"; echo "failed" > "$STATUS_FILE"; exit 1; }
126+
127+
# Kill any lingering next build processes
120128
pkill -f "next build" 2>/dev/null || true
121129
sleep 1
122130
rm -rf .next 2>/dev/null || true
17 Bytes
Binary file not shown.
27.7 KB
Binary file not shown.
40.8 KB
Binary file not shown.
Binary file not shown.

firetv/.gradle/8.5/dependencies-accessors/gc.properties

Whitespace-only changes.
70.9 KB
Binary file not shown.
17 Bytes
Binary file not shown.
1 Byte
Binary file not shown.
21.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)