fix(ci): free stale vite preview port before mock e2e.
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
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
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>
This commit is contained in:
@@ -67,7 +67,10 @@ jobs:
|
|||||||
run: bash scripts/install-playwright-chromium.sh
|
run: bash scripts/install-playwright-chromium.sh
|
||||||
|
|
||||||
- name: E2E mock suite
|
- name: E2E mock suite
|
||||||
run: npm run test:e2e
|
run: |
|
||||||
|
# act hostexecutor: зомби vite preview (cwd deleted) держит порт → HTTP 404 → webServer timeout
|
||||||
|
bash scripts/free-e2e-port.sh
|
||||||
|
npm run test:e2e
|
||||||
|
|
||||||
- name: Upload dist for docker job
|
- name: Upload dist for docker job
|
||||||
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.pipeline == 'full')
|
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.pipeline == 'full')
|
||||||
|
|||||||
@@ -50,9 +50,12 @@ export default defineConfig({
|
|||||||
webServer: liveTarget
|
webServer: liveTarget
|
||||||
? undefined
|
? undefined
|
||||||
: {
|
: {
|
||||||
command: `npm run preview -- --host 127.0.0.1 --port ${port}`,
|
// strictPort: не молчать, если порт занят зомби act-preview
|
||||||
|
command: `npm run preview -- --host 127.0.0.1 --port ${port} --strictPort`,
|
||||||
url: baseURL,
|
url: baseURL,
|
||||||
reuseExistingServer: !process.env.CI,
|
reuseExistingServer: !process.env.CI,
|
||||||
timeout: 120_000,
|
timeout: 120_000,
|
||||||
|
stdout: 'pipe',
|
||||||
|
stderr: 'pipe',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
#!/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
|
||||||
Reference in New Issue
Block a user