🔧 Improve health check robustness and timing
Some checks failed
Release - Northern Thailand Ping River Monitor / Create Release (push) Successful in 5s
Security & Dependency Updates / Dependency Security Scan (push) Successful in 26s
Security & Dependency Updates / License Compliance (push) Successful in 11s
Security & Dependency Updates / Check for Dependency Updates (push) Successful in 19s
Security & Dependency Updates / Security Summary (push) Has been cancelled
Security & Dependency Updates / Code Quality Metrics (push) Has been cancelled
Release - Northern Thailand Ping River Monitor / Test Release Build (3.11) (push) Has been cancelled
Release - Northern Thailand Ping River Monitor / Test Release Build (3.12) (push) Has been cancelled
Release - Northern Thailand Ping River Monitor / Test Release Build (3.9) (push) Has been cancelled
Release - Northern Thailand Ping River Monitor / Build Release Images (push) Has been cancelled
Release - Northern Thailand Ping River Monitor / Security Scan (push) Has been cancelled
Release - Northern Thailand Ping River Monitor / Test Release Deployment (push) Has been cancelled
Release - Northern Thailand Ping River Monitor / Notify Release (push) Has been cancelled
Release - Northern Thailand Ping River Monitor / Test Release Build (3.10) (push) Has been cancelled
Some checks failed
Release - Northern Thailand Ping River Monitor / Create Release (push) Successful in 5s
Security & Dependency Updates / Dependency Security Scan (push) Successful in 26s
Security & Dependency Updates / License Compliance (push) Successful in 11s
Security & Dependency Updates / Check for Dependency Updates (push) Successful in 19s
Security & Dependency Updates / Security Summary (push) Has been cancelled
Security & Dependency Updates / Code Quality Metrics (push) Has been cancelled
Release - Northern Thailand Ping River Monitor / Test Release Build (3.11) (push) Has been cancelled
Release - Northern Thailand Ping River Monitor / Test Release Build (3.12) (push) Has been cancelled
Release - Northern Thailand Ping River Monitor / Test Release Build (3.9) (push) Has been cancelled
Release - Northern Thailand Ping River Monitor / Build Release Images (push) Has been cancelled
Release - Northern Thailand Ping River Monitor / Security Scan (push) Has been cancelled
Release - Northern Thailand Ping River Monitor / Test Release Deployment (push) Has been cancelled
Release - Northern Thailand Ping River Monitor / Notify Release (push) Has been cancelled
Release - Northern Thailand Ping River Monitor / Test Release Build (3.10) (push) Has been cancelled
🕐 Enhanced Timing: - Increase attempts from 12 to 15 - Increase wait time from 10 to 15 seconds between attempts - Add longer curl timeouts (10s max, 5s connect) 🔍 Better Debugging: - More verbose health check logging - Show container status on each failed attempt - Clearer success/failure messages - Track attempt progress (X/15) 🌐 Improved Curl Options: - --max-time 10: Overall timeout - --connect-timeout 5: Connection timeout - -s: Silent mode (less noise) - -f: Fail on HTTP errors 🎯 Addresses Race Condition: - Container shows as healthy but curl fails immediately - Longer waits allow application full startup - Better visibility into what's happening during checks ✅ Should resolve timing issues with container startup
This commit is contained in:
@@ -218,14 +218,21 @@ jobs:
|
|||||||
echo "📋 Recent container logs:"
|
echo "📋 Recent container logs:"
|
||||||
docker logs --tail 10 ping-river-monitor-test || true
|
docker logs --tail 10 ping-river-monitor-test || true
|
||||||
|
|
||||||
# Wait for the application to be ready
|
# Wait for the application to be ready with more robust checking
|
||||||
for i in {1..12}; do
|
echo "🔍 Testing application readiness..."
|
||||||
if curl -f http://127.0.0.1:8080/health; then
|
for i in {1..15}; do
|
||||||
echo "✅ Health endpoint responding"
|
echo "⏳ Attempt $i/15: Testing health endpoint..."
|
||||||
|
|
||||||
|
# Use curl with more verbose output and longer timeout
|
||||||
|
if curl -f -s --max-time 10 --connect-timeout 5 http://127.0.0.1:8080/health; then
|
||||||
|
echo "✅ Health endpoint responding successfully!"
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
echo "⏳ Waiting for health endpoint... (attempt $i/12)"
|
echo "❌ Health check failed, waiting 15 seconds..."
|
||||||
sleep 10
|
# Show what's happening with the container
|
||||||
|
echo "Container status:"
|
||||||
|
docker ps | grep ping-river-monitor-test || echo "Container not found"
|
||||||
|
sleep 15
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user