Files
aleksey eb37476bdb
CI / test (push) Successful in 4m25s
CI / push-image (push) Successful in 12m27s
CI / deploy-ift (push) Successful in 16s
CI / ci-done (push) Successful in 0s
CI / e2e-ift (push) Successful in 2m46s
CI / deploy-stage (push) Successful in 11m55s
CI / e2e-stage (push) Successful in 4m34s
fix(ci): free stale vite preview port before mock e2e.
Act hostexecutor leaves zombie preview (cwd deleted) on :4173 returning 404; Playwright waits for 2xx and times out. Refs EventHub/EventHubFrontAdmin#40

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-17 21:24:41 +03:00

39 lines
1.2 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# Act hostexecutor делит сеть с хостом: после cancel/fail остаётся vite preview
# с cwd (deleted), порт занят, HTTP 404 → Playwright webServer ждёт 2xx до таймаута.
set -euo pipefail
PORT="${E2E_PORT:-4173}"
free_port() {
local pids=""
if command -v fuser >/dev/null 2>&1; then
fuser -k "${PORT}/tcp" >/dev/null 2>&1 || true
return 0
fi
if command -v lsof >/dev/null 2>&1; then
pids="$(lsof -t -iTCP:"${PORT}" -sTCP:LISTEN 2>/dev/null || true)"
elif command -v ss >/dev/null 2>&1; then
pids="$(ss -ltnp "sport = :${PORT}" 2>/dev/null | sed -n 's/.*pid=\([0-9]\+\).*/\1/p' | sort -u || true)"
fi
if [[ -n "${pids}" ]]; then
echo "free-e2e-port: killing PIDs on :${PORT}: ${pids}"
# shellcheck disable=SC2086
kill ${pids} 2>/dev/null || true
sleep 1
# shellcheck disable=SC2086
kill -9 ${pids} 2>/dev/null || true
fi
}
echo "free-e2e-port: ensuring :${PORT} is free"
free_port
if command -v ss >/dev/null 2>&1; then
if ss -ltn | grep -qE ":${PORT}\\s"; then
echo "WARN: :${PORT} still in use after free attempt" >&2
ss -ltnp | grep ":${PORT}" || true
else
echo "free-e2e-port: :${PORT} is free"
fi
fi