fix(ci): probe Docker smoke test inside container
This commit is contained in:
Vendored
+7
-9
@@ -139,14 +139,12 @@ pipeline {
|
||||
smoke_name="imagefind-smoke-$BUILD_NUMBER"
|
||||
mkdir -p .ci/docker-data
|
||||
./scripts/ci-docker.sh rm -f "$smoke_name" >/dev/null 2>&1 || true
|
||||
./scripts/ci-docker.sh run -d --name "$smoke_name" -p 127.0.0.1::8765 \
|
||||
./scripts/ci-docker.sh run -d --name "$smoke_name" \
|
||||
-e IMAGEFIND_ADMIN_PASSWORD='ImageFind-Smoke-2026!' \
|
||||
-v "$WORKSPACE/.ci/docker-data:/data" "$IMAGE_REF"
|
||||
host_port=$(./scripts/ci-docker.sh port "$smoke_name" 8765/tcp | sed -n 's/.*://p' | head -n 1)
|
||||
test -n "$host_port"
|
||||
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 exec "$smoke_name" curl -fsS http://127.0.0.1:8765/ >/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
|
||||
@@ -156,13 +154,13 @@ pipeline {
|
||||
sleep 2
|
||||
done
|
||||
test "$ready" = 1 || { ./scripts/ci-docker.sh logs "$smoke_name" || true; exit 1; }
|
||||
curl -fsS -H 'Content-Type: application/json' \
|
||||
./scripts/ci-docker.sh exec "$smoke_name" 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'
|
||||
http://127.0.0.1:8765/api/v1/auth/login | grep -q 'csrf'
|
||||
./scripts/ci-docker.sh restart "$smoke_name" >/dev/null
|
||||
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 exec "$smoke_name" curl -fsS http://127.0.0.1:8765/ >/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
|
||||
@@ -172,9 +170,9 @@ pipeline {
|
||||
sleep 2
|
||||
done
|
||||
test "$ready" = 1 || { ./scripts/ci-docker.sh logs "$smoke_name" || true; exit 1; }
|
||||
curl -fsS -H 'Content-Type: application/json' \
|
||||
./scripts/ci-docker.sh exec "$smoke_name" 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'
|
||||
http://127.0.0.1:8765/api/v1/auth/login | grep -q 'csrf'
|
||||
test -s .ci/docker-data/postgresql/PG_VERSION
|
||||
test -s .ci/docker-data/postgres-client.conf
|
||||
test -e .ci/docker-data/.imagefind-admin-initialized
|
||||
|
||||
Reference in New Issue
Block a user