Retry database readiness in live smoke
GeoIntel CI / docs-smoke (push) Has been cancelled
GeoIntel CI / contract-smoke (push) Has been cancelled

This commit is contained in:
Codex
2026-06-17 04:56:48 +02:00
parent b00afa9181
commit 894e6ec2c1
+32 -6
View File
@@ -20,13 +20,26 @@ cd /app
echo "Database URL is read from backend container settings / DATABASE_URL."
python - <<'PY'
import time
from sqlalchemy import text
from sqlalchemy.exc import OperationalError
from app.db.session import get_engine
with get_engine().connect() as connection:
connection.execute(text("SELECT 1"))
print("Database connection: ok")
last_error = None
for attempt in range(1, 61):
try:
with get_engine().connect() as connection:
connection.execute(text("SELECT 1"))
print(f"Database connection: ok after attempt {attempt}")
break
except OperationalError as exc:
last_error = exc
print(f"Database not ready yet ({attempt}/60): {exc}")
time.sleep(2)
else:
raise SystemExit(f"Database did not become ready: {last_error}")
PY
python -m alembic upgrade head
@@ -113,13 +126,26 @@ echo "Using Python: $PYTHON_BIN"
echo "Database URL is read from backend settings / DATABASE_URL."
"$PYTHON_BIN" - <<'PY'
import time
from sqlalchemy import text
from sqlalchemy.exc import OperationalError
from app.db.session import get_engine
with get_engine().connect() as connection:
connection.execute(text("SELECT 1"))
print("Database connection: ok")
last_error = None
for attempt in range(1, 61):
try:
with get_engine().connect() as connection:
connection.execute(text("SELECT 1"))
print(f"Database connection: ok after attempt {attempt}")
break
except OperationalError as exc:
last_error = exc
print(f"Database not ready yet ({attempt}/60): {exc}")
time.sleep(2)
else:
raise SystemExit(f"Database did not become ready: {last_error}")
PY
"$PYTHON_BIN" -m alembic upgrade head