-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Metadata: Retry dockerhub fetch on metadata post publish fail #32626
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice improvement 👍
I'd appreciate:
- Not swallowing DockerHub API errors by being more specific about the status code we handle (
404
)
*A unit test ofis_image_on_dockerhub
to prevent future regression
airbyte-ci/connectors/metadata_service/lib/metadata_service/docker_hub.py
Outdated
Show resolved
Hide resolved
# Allow for retries as the DockerHub API is not always reliable with returning the latest publish. | ||
for _ in range(retries + 1): | ||
response = requests.get(tag_url, headers=headers) | ||
if response.ok: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we retry on 404
only and raise if the response status is not 200
or 404
? The current implementation will swallow DockerHub API errors and end up wit the "Image does not exists" error message, even if the failure is not related to the existence/absence of the image.
try:
response = requests.get(tag_url, headers=headers)
response.raise_for_status()
if response.ok:
break
except requests.HTTPError as e:
if e.status_code == 404:
continue
raise e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im worried that dockerhub during intermittent issues is not throwing just a 404. But could also throw a 500 or a 401.
Is that a valid fear?
also wdyt about the retry then an the end if still failing raising an error with the error message so we dont swallow it?
Problem
The dockerhub api can be stale and not return an image even though its published
From this slack discussion
https://airbytehq-team.slack.com/archives/C03VDJ4FMJB/p1700182656932749
Solution
Metadata validation will retry up to 3 times 30 seconds apart to find the image
Future
We may be able to rework this to work off the local instance of docker which downloads these images much faster