Fix demo server workflow verification by adding authentication

The workflow was failing because /api/state requires authentication,
but the verification step was making an unauthenticated request.

Changes:
- Authenticate with demo/demo credentials before checking node count
- Use jq for cleaner JSON parsing instead of grep/cut
- Check total node count from API response instead of regex pattern matching

Related to user report about demo server not updating to 4.26.3.
The demo server was actually updated successfully, but the workflow
marked itself as failed due to the verification check failing.
This commit is contained in:
rcourtman 2025-11-06 17:44:46 +00:00
parent ead325942e
commit b50dba577f

View file

@ -36,13 +36,13 @@ jobs:
# Check version endpoint
VERSION=$(ssh -i ~/.ssh/id_ed25519 ${{ secrets.DEMO_SERVER_USER }}@${{ secrets.DEMO_SERVER_HOST }} \
"curl -s http://localhost:7655/api/version | grep -o '\"version\":\"[^\"]*' | cut -d'\"' -f4")
"curl -s http://localhost:7655/api/version | jq -r .version")
echo "Demo server is now running version: $VERSION"
# Verify mock mode is active
# Verify mock mode is active by authenticating and checking node count
NODES=$(ssh -i ~/.ssh/id_ed25519 ${{ secrets.DEMO_SERVER_USER }}@${{ secrets.DEMO_SERVER_HOST }} \
"curl -s http://localhost:7655/api/state | grep -o '\"nodes\":\[[^]]*\]' | grep -o 'pve[0-9]' | wc -l")
'curl -s -c /tmp/demo-cookies.txt http://localhost:7655/api/login -X POST -H "Content-Type: application/json" -d "{\"username\":\"demo\",\"password\":\"demo\"}" > /dev/null && curl -s -b /tmp/demo-cookies.txt http://localhost:7655/api/state | jq -r ".nodes | length" && rm -f /tmp/demo-cookies.txt')
echo "Mock nodes detected: $NODES"