-
Notifications
You must be signed in to change notification settings - Fork 112
Version Chooser: deal (badly) with dockerhub api changes #3490
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,6 +110,22 @@ async def fetch_remote_tags(self, repository: str, local_images: List[str]) -> T | |
my_architecture = get_current_arch() | ||
valid_images = [] | ||
for tag in tags: | ||
images = tag["images"] | ||
if len(images) == 0: | ||
# this is a hack to deal with https://github.com/docker/hub-feedback/issues/2484 | ||
Comment on lines
+114
to
+115
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: Consider logging or surfacing when tags have no images for better traceability. Logging a warning when this fallback is triggered will help with monitoring and debugging, especially if Docker Hub's behavior changes or unexpected tags appear. Suggested implementation: import logging
logger = logging.getLogger(__name__)
my_architecture = get_current_arch()
valid_images = []
for tag in tags:
images = tag["images"]
if len(images) == 0:
logger.warning(
"Tag '%s' in repository '%s' has no images. Fallback logic triggered. See https://github.com/docker/hub-feedback/issues/2484",
tag.get("name", "<unknown>"),
repository,
)
# this is a hack to deal with https://github.com/docker/hub-feedback/issues/2484
# we lost the ability to properly identify the images as we dont have the digest,
# and also the ability to filter for compatible architectures.
# so we just add the tag and hope for the best.
tag = TagMetadata(
repository=repository,
image=repository.split("/")[-1],
tag=tag["name"],
last_modified=tag["last_updated"],
sha=None,
digest="------",
)
valid_images.append(tag) If your project already has a logger instance (e.g., |
||
# we lost the ability to properly identify the images as we dont have the digest, | ||
# and also the ability to filter for compatible architectures. | ||
# so we just add the tag and hope for the best. | ||
tag = TagMetadata( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should log a warning here |
||
repository=repository, | ||
image=repository.split("/")[-1], | ||
tag=tag["name"], | ||
last_modified=tag["last_updated"], | ||
sha=None, | ||
digest="------", | ||
) | ||
valid_images.append(tag) | ||
continue | ||
for image in tag["images"]: | ||
if image["architecture"] == my_architecture: | ||
tag = TagMetadata( | ||
|
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.
suggestion (testing): Test does not cover edge case for tags with missing images (digest set to '------').
Please add a test for tags with missing images (digest set to '------') to confirm TagMetadata is constructed correctly and downstream code handles this case.