deploy: domain-collision pre-check with clear error
This commit is contained in:
parent
d1b73c38a0
commit
2955af73f4
1 changed files with 16 additions and 0 deletions
16
action.yml
16
action.yml
|
|
@ -138,6 +138,22 @@ runs:
|
||||||
fi
|
fi
|
||||||
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
|
case "$DT" in
|
||||||
static)
|
static)
|
||||||
# build IN-PLACE — the job runs on platform-ci-base which has bun, so no
|
# build IN-PLACE — the job runs on platform-ci-base which has bun, so no
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue