Loop to check the health status
This commit is contained in:
@@ -49,8 +49,16 @@ jobs:
|
|||||||
|
|
||||||
- name: Check Health
|
- name: Check Health
|
||||||
run: |
|
run: |
|
||||||
HEALTH_STATUS=$(docker inspect --format='{{.State.Health.Status}}' rails-on-docker);
|
for i in {1..30}; do
|
||||||
echo "$HEALTH_STATUS"
|
status=$(docker inspect --format='{{.State.Health.Status}}' rails-on-docker)
|
||||||
if [ "$HEALTH_STATUS" != "healthy" ]; then
|
if [ "$status" = "healthy" ]; then
|
||||||
exit 1
|
echo "Container is healthy"
|
||||||
fi
|
exit 0
|
||||||
|
elif [ "$status" = "unhealthy" ]; then
|
||||||
|
echo "Container is unhealthy"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
echo "Timed out waiting for container to become healthy"
|
||||||
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user