Skip to content

Commit

Permalink
CI allows an initial restart or 2, then sleeps 10 to catch continuous…
Browse files Browse the repository at this point in the history
… restarts
  • Loading branch information
yorickdowne committed Aug 4, 2023
1 parent b774b9c commit d5f948c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions .github/check-service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ __service=$1

__containerID=$(docker-compose ps -q "${__service}")

__restart_count=$(docker inspect --format '{{ .RestartCount }}' "$__containerID")
__running=$(docker inspect --format '{{ .State.Running }}' "$__containerID")
__initial_restart_count=$(docker inspect --format '{{ .RestartCount }}' "$__containerID")
__is_running=$(docker inspect --format '{{ .State.Running }}' "$__containerID")
sleep 10
__final_restart_count=$(docker inspect --format '{{ .RestartCount }}' "$__containerID")

if [ "$__running" != "true" ] || [ "$__restart_count" -gt 0 ]; then
if [ "$__is_running" != "true" ] || [ "$__final_restart_count" -gt "$__initial_restart_count" ]; then
echo "$__service is either not running or continuously restarting"
docker-compose ps "${__service}"
docker-compose logs "${__service}"
Expand Down

0 comments on commit d5f948c

Please sign in to comment.