trails/.github/workflows
Ullrich Schäfer e23751f29e
Fix concurrent preview deploy race: per-PR env files + server flock
Three changes:

1. Skip GH-Actions-only Dependabot PRs (dependabot/github_actions/*) in
   deploy-preview — there is no app image to preview, and these PRs were
   landing phantom containers with mismatched ports.

2. Use per-PR env files (staging-pr-{N}.env) instead of the shared
   staging.env for preview deploys and teardowns. Concurrent SCP transfers
   to the same filename were overwriting each other, causing wrong
   JOURNAL_HOST_PORT / JOURNAL_IMAGE_TAG values to be used.

3. Serialize server-side deploy operations with a flock on
   /tmp/trails-preview-deploy.lock (300s timeout). Eviction + compose up
   must be atomic; without the lock, two simultaneous jobs could both see
   "3 active previews" and both evict different projects, or one could
   start compose up against a just-evicted env.

Triggered by a Dependabot batch today (PRs 371-373) that opened
simultaneously and produced a phantom trails-pr-371 container running
the pr-370 image on port 3940 while the Caddyfile expected 3942,
causing sustained 502s on pr-371.staging.trails.cool.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-10 13:03:52 +02:00
..
cd-apps.yml Apply wahoo-route-update: PUT on re-push instead of duplicate POST 2026-05-01 12:08:16 +02:00
cd-brouter.yml Update brouter deploy scp to single ssh 2026-04-24 14:41:30 +02:00
cd-infra.yml Rebuild the Journal home around a public feed and flagship marketing 2026-04-24 20:00:23 +02:00
cd-staging.yml Fix concurrent preview deploy race: per-PR env files + server flock 2026-05-10 13:03:52 +02:00
ci.yml Add CI check for missing workspace packages in Dockerfiles 2026-04-14 12:15:25 +02:00
dependabot-dedupe.yml Prefix dedupe commit message + set GH_TOKEN for push step 2026-04-19 21:06:38 +02:00
staging-cleanup.yml Fix concurrent preview deploy race: per-PR env files + server flock 2026-05-10 13:03:52 +02:00