fix(deploy): use container IP dynamically for build-info health check in CI runner
This commit is contained in:
@@ -75,8 +75,16 @@ fi
|
||||
|
||||
nginx -t 2>/dev/null && systemctl reload nginx 2>/dev/null || true
|
||||
|
||||
CONTAINER_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' memento-note 2>/dev/null || true)
|
||||
|
||||
for i in $(seq 1 24); do
|
||||
BODY=$(curl -sf --max-time 3 http://127.0.0.1:3000/api/build-info 2>/dev/null || true)
|
||||
BODY=""
|
||||
if [ -n "$CONTAINER_IP" ]; then
|
||||
BODY=$(curl -sf --max-time 3 "http://${CONTAINER_IP}:3000/api/build-info" 2>/dev/null || true)
|
||||
fi
|
||||
if [ -z "$BODY" ]; then
|
||||
BODY=$(curl -sf --max-time 3 http://127.0.0.1:3000/api/build-info 2>/dev/null || true)
|
||||
fi
|
||||
ACTUAL=$(echo "$BODY" | jq -r '.commit // empty' 2>/dev/null || true)
|
||||
if [ "$ACTUAL" = "$GIT_COMMIT" ]; then
|
||||
echo "OK build-info commit=$ACTUAL"
|
||||
|
||||
Reference in New Issue
Block a user