Replace static delays with active health checks in CI/CD workflows to ensure service readiness. Instead of using fixed sleep times, implement polling mechanisms that verify service health endpoints. This improves workflow reliability and reduces false negatives.
Example implementation:
- name: Wait for service readiness
run: |
for i in {1..18}; do # 18 ร 5 s = 90 s timeout
if curl -fs http://localhost/health >/dev/null; then
break
fi
echo "๐ Waiting for service to become healthy... ($i)"
sleep 5
done
curl -fs http://localhost/health >/dev/null || {
echo "โ Service did not become healthy in time" >&2
exit 1
}
This approach:
Enter the URL of a public GitHub repository