Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref: retry on 500s in docker pulls #43700

Merged
merged 1 commit into from
Jan 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/sentry/runner/commands/devservices.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def get_or_create(


def retryable_pull(client: docker.DockerClient, image: str, max_attempts: int = 5) -> None:
from docker.errors import ImageNotFound
from docker.errors import APIError

current_attempt = 0

Expand All @@ -100,12 +100,13 @@ def retryable_pull(client: docker.DockerClient, image: str, max_attempts: int =
while True:
try:
client.images.pull(image)
except ImageNotFound as e:
except APIError:
if current_attempt + 1 >= max_attempts:
raise e
raise
current_attempt = current_attempt + 1
continue
break
else:
break


def ensure_interface(ports: dict[str, int | tuple[str, int]]) -> dict[str, tuple[str, int]]:
Expand Down