From ee212a2c7420618caa99bca073bba6a3141debd5 Mon Sep 17 00:00:00 2001 From: lukken <lukken@astron.nl> Date: Mon, 24 Oct 2022 08:14:37 +0000 Subject: [PATCH] L2SS-988: Improve await script in Makefile --- docker-compose/Makefile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docker-compose/Makefile b/docker-compose/Makefile index e7c3c0576..102569164 100644 --- a/docker-compose/Makefile +++ b/docker-compose/Makefile @@ -228,10 +228,13 @@ await: ## Await every container with total max timeout of 300, do not reset tim time=0 for i in $(SERVICE); do \ current_service=$$($(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) ps -q $${i}); \ - while [ "`docker inspect -f {{.State.Health.Status}} $${current_service}`" != "healthy" ] ; do \ + if [ -z "$${current_service}" ]; then \ + continue; \ + fi; \ + while [ "$$(docker inspect -f '{{.State.Health.Status}}' $${current_service})" != "healthy" ] ; do \ sleep 1; \ - time=`expr $$time + 1`; \ - if [ $${time} -gt $${TIMEOUT} ]; then \ + time=$$(expr $${time} + 1); \ + if [ $${time} -gt $(TIMEOUT) ]; then \ echo "Timeout reached waiting for $${i} to become healthy"; \ exit 1; \ fi; \ -- GitLab