diff --git a/scripts/harb-evaluator/evaluate.sh b/scripts/harb-evaluator/evaluate.sh index 303c75e..96d3b1e 100755 --- a/scripts/harb-evaluator/evaluate.sh +++ b/scripts/harb-evaluator/evaluate.sh @@ -193,9 +193,16 @@ wait_healthy() { log "Waiting for $service to be healthy (${timeout}s)..." local deadline=$((SECONDS + timeout)) while (( SECONDS < deadline )); do - local status - status="$(docker inspect --format='{{.State.Health.Status}}' "$container" 2>/dev/null || echo "missing")" - if [[ "$status" == "healthy" ]]; then + local container_state health_status + container_state="$(docker inspect --format='{{.State.Status}}' "$container" 2>/dev/null || echo "missing")" + if [[ "$container_state" == "exited" || "$container_state" == "dead" ]]; then + local exit_code + exit_code="$(docker inspect --format='{{.State.ExitCode}}' "$container" 2>/dev/null || echo "1")" + docker logs "$container" 2>&1 | tail -20 || true + infra_error "$service exited (code $exit_code) before becoming healthy" + fi + health_status="$(docker inspect --format='{{.State.Health.Status}}' "$container" 2>/dev/null || echo "missing")" + if [[ "$health_status" == "healthy" ]]; then log " $service healthy" return 0 fi