From be44fd61679b0cb4badc12cc322a7c968ebcec08 Mon Sep 17 00:00:00 2001 From: nanxun Date: Wed, 12 Aug 2026 16:33:17 +0800 Subject: [PATCH] fix(ci): fail fast when smoke container exits --- Jenkinsfile | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 276e23b..e87cbc9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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'