fix: fix health check using status
This commit is contained in:
12
.github/workflows/deploy-server.yml
vendored
12
.github/workflows/deploy-server.yml
vendored
@@ -140,13 +140,13 @@ jobs:
|
|||||||
SSH_USER="${{ vars.SSH_USER || 'root' }}"
|
SSH_USER="${{ vars.SSH_USER || 'root' }}"
|
||||||
|
|
||||||
# Wait for services to be ready
|
# Wait for services to be ready
|
||||||
timeout 300 bash -c 'until sfp server health --tenant "'"$TENANT"'" --ssh-connection "'"$SSH_USER@$SSH_HOST"'" --identity-file ~/.ssh/deploy_key; do sleep 5; done'
|
timeout 300 bash -c 'until sfp server status --tenant "'"$TENANT"'" --ssh-connection "'"$SSH_USER@$SSH_HOST"'" --identity-file ~/.ssh/deploy_key --json | grep -A 100 "^{$" | jq -e "all(.result.services[]; .state == \"running\")" > /dev/null; do sleep 5; done'
|
||||||
|
|
||||||
# Detailed health check
|
# Detailed status check
|
||||||
HEALTH_STATUS=$(sfp server health --tenant "$TENANT" --ssh-connection "$SSH_USER@$SSH_HOST" --identity-file ~/.ssh/deploy_key --json)
|
STATUS_RESULT=$(sfp server status --tenant "$TENANT" --ssh-connection "$SSH_USER@$SSH_HOST" --identity-file ~/.ssh/deploy_key --json | grep -A 100 "^{$")
|
||||||
|
|
||||||
if echo "$HEALTH_STATUS" | jq -e '.healthy == true' > /dev/null; then
|
if echo "$STATUS_RESULT" | jq -e 'all(.result.services[]; .state == "running")' > /dev/null; then
|
||||||
echo "✅ Server is healthy after deployment"
|
echo "✅ All services are running after deployment"
|
||||||
echo "healthy=true" >> $GITHUB_OUTPUT
|
echo "healthy=true" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
# Get new version
|
# Get new version
|
||||||
@@ -154,7 +154,7 @@ jobs:
|
|||||||
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
|
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
|
||||||
echo "📦 New version: $NEW_VERSION"
|
echo "📦 New version: $NEW_VERSION"
|
||||||
else
|
else
|
||||||
echo "❌ Server health check failed"
|
echo "❌ Some services are not running"
|
||||||
echo "healthy=false" >> $GITHUB_OUTPUT
|
echo "healthy=false" >> $GITHUB_OUTPUT
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user