feat(stability): unify readiness and recovery
CI - Build & Test / Backend (.NET) (push) Successful in 45s
CI - Build & Test / Backend integration (PostgreSQL/Toxiproxy) (push) Failing after 1m0s
CI - Build & Test / Frontend (Vue/TS) (push) Successful in 2m49s
CI - Build & Test / Security Check (push) Successful in 7s
CI - Build & Test / Deploy Nexus (push) Has been skipped
CI - Build & Test / Backend (.NET) (push) Successful in 45s
CI - Build & Test / Backend integration (PostgreSQL/Toxiproxy) (push) Failing after 1m0s
CI - Build & Test / Frontend (Vue/TS) (push) Successful in 2m49s
CI - Build & Test / Security Check (push) Successful in 7s
CI - Build & Test / Deploy Nexus (push) Has been skipped
This commit is contained in:
@@ -125,6 +125,21 @@ docker run --rm \
|
||||
docker compose --env-file /tmp/nexus-deploy-env ps
|
||||
' < "$ENV_TMPFILE"
|
||||
|
||||
echo "Checking container readiness"
|
||||
retry=0
|
||||
while [ "$retry" -lt 6 ]; do
|
||||
retry=$((retry + 1))
|
||||
if docker exec nexus-api-1 curl -fs --max-time 5 http://localhost:8080/health/ready >/dev/null; then
|
||||
echo "API container is ready"
|
||||
break
|
||||
fi
|
||||
if [ "$retry" -eq 6 ]; then
|
||||
echo "API container readiness failed" >&2
|
||||
exit 1
|
||||
fi
|
||||
sleep "$retry"
|
||||
done
|
||||
|
||||
echo "Verifying image provenance"
|
||||
for container in nexus-api-1 nexus-web-1; do
|
||||
revision="$(docker inspect --format '{{ index .Config.Labels "org.opencontainers.image.revision" }}' "$container")"
|
||||
@@ -140,9 +155,13 @@ for container in nexus-api-1 nexus-web-1; do
|
||||
echo "$container provenance verified: v$version $revision"
|
||||
done
|
||||
|
||||
echo "Checking live health"
|
||||
health_is_healthy() {
|
||||
health_body="$(curl -fsS --max-time 10 "$BASE_URL/health")" || return 1
|
||||
echo "Checking public readiness and dependency health"
|
||||
readiness_is_healthy() {
|
||||
curl -fs --max-time 10 "$BASE_URL/health/ready" >/dev/null
|
||||
}
|
||||
|
||||
runtime_is_healthy() {
|
||||
health_body="$(curl -fs --max-time 10 "$BASE_URL/health")" || return 1
|
||||
printf '%s' "$health_body" |
|
||||
grep -Eq '^[[:space:]]*\{[[:space:]]*"status"[[:space:]]*:[[:space:]]*"Healthy"'
|
||||
}
|
||||
@@ -150,8 +169,8 @@ health_is_healthy() {
|
||||
retry=0
|
||||
while [ "$retry" -lt 6 ]; do
|
||||
retry=$((retry + 1))
|
||||
if health_is_healthy; then
|
||||
echo "Health check passed with Healthy runtime and database state"
|
||||
if readiness_is_healthy && runtime_is_healthy; then
|
||||
echo "Readiness and full dependency health passed"
|
||||
break
|
||||
fi
|
||||
if [ "$retry" -eq 6 ]; then
|
||||
@@ -177,8 +196,8 @@ check() {
|
||||
}
|
||||
|
||||
check_health() {
|
||||
if health_is_healthy; then
|
||||
printf '%-28s HTTP 200 (Healthy)\n' "Health"
|
||||
if readiness_is_healthy && runtime_is_healthy; then
|
||||
printf '%-28s HTTP 200 (Ready + Healthy)\n' "Health"
|
||||
pass=$((pass + 1))
|
||||
else
|
||||
printf '%-28s not healthy\n' "Health"
|
||||
|
||||
Reference in New Issue
Block a user