deploy: domain-collision pre-check with clear error

This commit is contained in:
ops 2026-06-02 16:11:34 +00:00
parent d1b73c38a0
commit 2955af73f4

View file

@ -138,6 +138,22 @@ runs:
fi
fi
# ---- domain collision pre-check: clear error instead of a raw caddy
# "ambiguous site definition" when another deploy already serves this domain ----
for dom in "$DOMAIN" ${ALT:+"$ALT"}; do
for frag in /srv/platform/caddy/sites/*.caddy; do
[ -f "$frag" ] || continue
base=$(basename "$frag")
{ [ "$base" = "${SLUG}.caddy" ] || [ "$base" = "_platform.caddy" ]; } && continue
for a in $(sed -n '1,/{/p' "$frag" | tr -d '{' | tr ',' ' '); do
if [ "$a" = "$dom" ]; then
echo "::error::domain '$dom' is already served by another deploy ($base). Change DOMAIN in your .env, or ask the admin to free it (remove $base)."
exit 1
fi
done
done
done
case "$DT" in
static)
# build IN-PLACE — the job runs on platform-ci-base which has bun, so no