Update main.yml

This commit is contained in:
Gleb Tcivie 2024-07-10 09:29:47 +03:00 committed by GitHub
parent a8be85e20c
commit c4b051183a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -17,7 +17,7 @@ jobs:
- name: Wait for containers to start
run: sleep 60 # 1 Minute
- name: Check container statuses
- name: Check container statuses and logs
run: |
services=("prometheus" "grafana" "exporter" "postgres")
@ -27,6 +27,7 @@ jobs:
if [ -z "$container_id" ]; then
echo "Error: Container for $service not found"
docker-compose logs $service
exit 1
fi
@ -35,11 +36,15 @@ jobs:
if [ "$status" != "running" ]; then
echo "Error: Container $service ($container_id) is not running. Current status: $status"
echo "Last logs for $service:"
docker-compose logs --tail=50 $service
exit 1
fi
if [ "$restarts" -gt 0 ]; then
echo "Error: Container $service ($container_id) has restarted $restarts times"
echo "Last logs for $service:"
docker-compose logs --tail=50 $service
exit 1
fi