Skip to content

Commit 220a38a

Browse files
committed
make retry nicer
1 parent 196d2af commit 220a38a

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Makefile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -866,9 +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-
docker pull gcr.io/coder-dev-1/postgres:${POSTGRES_VERSION} || \
871-
docker pull gcr.io/coder-dev-1/postgres:${POSTGRES_VERSION}
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+
}
872879

873880
# Make sure to not overallocate work_mem and max_connections as each
874881
# connection will be allowed to use this much memory. Try adjusting

0 commit comments

Comments
 (0)