@@ -111,6 +111,25 @@ jobs:
|
||||
docker rm devops-platform || true
|
||||
if ! IMAGE="$OLD_IMAGE" docker compose up -d --no-build app; then
|
||||
echo "ERROR: rollback failed; manual recovery required"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ROLLBACK_HEALTHY=false
|
||||
|
||||
for attempt in $(seq 1 15); do
|
||||
if docker exec devops-platform python -c \
|
||||
"import urllib.request; r=urllib.request.urlopen('http://127.0.0.1:8000/health', timeout=2); assert r.status == 200"; then
|
||||
ROLLBACK_HEALTHY=true
|
||||
break
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
|
||||
if [ "$ROLLBACK_HEALTHY" = true ]; then
|
||||
echo "Rollback successful; previous version is healthy"
|
||||
else
|
||||
echo "ERROR: rollback container failed health check; manual recovery required"
|
||||
fi
|
||||
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user