fix(ci): fail fast when smoke container exits

This commit is contained in:
2026-08-12 16:33:17 +08:00
parent 59c090bbc4
commit be44fd6167
Vendored
+13 -1
View File
@@ -147,6 +147,12 @@ pipeline {
ready=0
for attempt in $(seq 1 90); do
if curl -fsS "http://127.0.0.1:$host_port/" >/dev/null; then ready=1; break; fi
if ! ./scripts/ci-docker.sh inspect --format '{{.State.Running}}' "$smoke_name" 2>/dev/null | grep -qx true; then
echo "Smoke container exited before becoming ready (attempt $attempt)." >&2
./scripts/ci-docker.sh logs "$smoke_name" || true
./scripts/ci-docker.sh inspect "$smoke_name" || true
exit 1
fi
sleep 2
done
test "$ready" = 1 || { ./scripts/ci-docker.sh logs "$smoke_name" || true; exit 1; }
@@ -157,9 +163,15 @@ pipeline {
ready=0
for attempt in $(seq 1 60); do
if curl -fsS "http://127.0.0.1:$host_port/" >/dev/null; then ready=1; break; fi
if ! ./scripts/ci-docker.sh inspect --format '{{.State.Running}}' "$smoke_name" 2>/dev/null | grep -qx true; then
echo "Smoke container exited after restart (attempt $attempt)." >&2
./scripts/ci-docker.sh logs "$smoke_name" || true
./scripts/ci-docker.sh inspect "$smoke_name" || true
exit 1
fi
sleep 2
done
test "$ready" = 1
test "$ready" = 1 || { ./scripts/ci-docker.sh logs "$smoke_name" || true; exit 1; }
curl -fsS -H 'Content-Type: application/json' \
--data '{"password":"ImageFind-Smoke-2026!"}' \
"http://127.0.0.1:$host_port/api/v1/auth/login" | grep -q 'csrf'