Skip to content

Commit d57941d

Browse files
committed
make retry nicer
1 parent 196d2af commit d57941d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,16 @@ test-postgres-docker:
866866
docker rm -f test-postgres-docker-${POSTGRES_VERSION} || true
867867

868868
# Try pulling up to three times to avoid CI flakes.
869+
docker pull gcr.io/coder-dev-1/postgres:${POSTGRES_VERSION} || {
870+
retries=2
871+
for try in $(seq 1 ${retries}); do
872+
echo "Failed to pull image, retrying (${try}/${retries})..."
873+
sleep 1
874+
if docker pull gcr.io/coder-dev-1/postgres:${POSTGRES_VERSION}; then
875+
break
876+
fi
877+
done
878+
}
869879
docker pull gcr.io/coder-dev-1/postgres:${POSTGRES_VERSION} || \
870880
docker pull gcr.io/coder-dev-1/postgres:${POSTGRES_VERSION} || \
871881
docker pull gcr.io/coder-dev-1/postgres:${POSTGRES_VERSION}

0 commit comments

Comments
 (0)