Skip to content

Commit 4e22587

Browse files
authored
ci: use wait option for docker compose (#452)
1 parent 1a2587f commit 4e22587

File tree

1 file changed

+1
-23
lines changed

1 file changed

+1
-23
lines changed

.github/workflows/test.yaml

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -119,31 +119,9 @@ jobs:
119119
- name: Pull Docker images
120120
run: docker compose --progress quiet -f $DOCKER_COMPOSE_FILE pull
121121
- name: Run containers
122-
run: docker compose --progress quiet -f $DOCKER_COMPOSE_FILE up -d
122+
run: docker compose --progress quiet -f $DOCKER_COMPOSE_FILE up --wait --wait-timeout 30
123123
env:
124124
HOST_ADDR: ${{ env.HOST_IP_ADDR }}
125-
- name: Wait for nodes to be ready
126-
run: |
127-
node_cnt=$(docker compose -f $DOCKER_COMPOSE_FILE ps --format json | jq -s 'length')
128-
i=0
129-
while :
130-
do
131-
if [[ $i -gt $MAX_ATTEMPTS ]]
132-
then
133-
echo "Max attempts exceeded: $i times"
134-
exit 1
135-
fi
136-
healthy_cnt=$(docker compose -f $DOCKER_COMPOSE_FILE ps --format json | jq -s 'map(select(.Health == "healthy")) | length')
137-
if [[ $healthy_cnt -eq $node_cnt ]]
138-
then
139-
break
140-
fi
141-
echo 'Waiting for nodes to be ready...'
142-
sleep 3
143-
: $((++i))
144-
done
145-
env:
146-
MAX_ATTEMPTS: "10"
147125
- name: Print containers
148126
run: docker compose -f $DOCKER_COMPOSE_FILE ps
149127
- name: Build cluster

0 commit comments

Comments
 (0)