#!/usr/bin/env bash # ═══════════════════════════════════════════════ # Wait for Armature server to be healthy # ═══════════════════════════════════════════════ # Usage: ./ci/wait-for-healthy.sh [URL] [MAX_RETRIES] set -euo pipefail HOST="${1:-http://localhost:3000}" MAX_RETRIES="${2:-60}" echo "Waiting for ${HOST} to be healthy..." for i in $(seq 1 "$MAX_RETRIES"); do if curl -sf --connect-timeout 2 "${HOST}/api/v1/auth/login" -o /dev/null 2>/dev/null; then echo "Server healthy after ${i}s" exit 0 fi sleep 1 done echo "Server not healthy after ${MAX_RETRIES}s" exit 1