Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion scripts/selfhost-post-update-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,23 @@ if [ "$ready" -ne 1 ]; then
exit 1
fi

status="$(docker inspect --format '{{if .State.Health}}{{.State.Health.Status}}{{else}}{{.State.Status}}{{end}}' "$container_id" 2>/dev/null || true)"
# Same race as the /ready probe above, one layer down: Docker's OWN healthcheck (docker-compose.yml)
# reports "starting" until its FIRST probe completes, which can still be true here even though /ready
# already answered 2xx (the two checks run on independent schedules) -- a normal boot must not fail on
# a state that is expected to resolve on its own within seconds. Only "starting" is worth waiting
# through; any other non-healthy/running status (unhealthy, exited, restarting, ...) is a real problem
# and fails immediately rather than burning the full retry budget on something that will not resolve.
status=""
for _ in $(seq 1 "$READY_RETRIES"); do
status="$(docker inspect --format '{{if .State.Health}}{{.State.Health.Status}}{{else}}{{.State.Status}}{{end}}' "$container_id" 2>/dev/null || true)"
if [ "$status" = "healthy" ] || [ "$status" = "running" ]; then
break
fi
if [ "$status" != "starting" ]; then
break
fi
sleep "$READY_RETRY_DELAY_SECONDS"
done
echo "selfhost post-update check: $SERVICE container status=$status"
if [ "$status" != "healthy" ] && [ "$status" != "running" ]; then
echo "error: expected healthy or running, got $status" >&2
Expand Down