Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 08ffcb7

Browse files
authored
test(Makefile): retry pulling postgres in test-postgres-docker (#16178)
1 parent 7cf6242 commit 08ffcb7

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Makefile

+13
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,19 @@ test-migrations: test-postgres-docker
864864
# NOTE: we set --memory to the same size as a GitHub runner.
865865
test-postgres-docker:
866866
docker rm -f test-postgres-docker-${POSTGRES_VERSION} || true
867+
868+
# 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+
}
879+
867880
# Make sure to not overallocate work_mem and max_connections as each
868881
# connection will be allowed to use this much memory. Try adjusting
869882
# shared_buffers instead, if needed.

0 commit comments

Comments
 (0)