-
Notifications
You must be signed in to change notification settings - Fork 111
Backports/1.3/dockerhub workaround #3494
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
base: 1.3
Are you sure you want to change the base?
Backports/1.3/dockerhub workaround #3494
Conversation
Reviewer's GuideThis backport implements a DockerHub workaround by adding fallback tag handling for entries with empty images and introduces integration tests for the TagFetcher in the 1.3 branch. Sequence diagram for DockerHub tag fetching with empty images workaroundsequenceDiagram
participant TagFetcher
participant DockerHubAPI
participant TagMetadata
TagFetcher->>DockerHubAPI: fetch tags for repository
DockerHubAPI-->>TagFetcher: return tags (some with empty images)
loop for each tag
alt images list is empty
TagFetcher->>TagMetadata: create TagMetadata with digest="------" and sha=None
TagFetcher->>TagFetcher: add tag to valid_images
else images list is not empty
TagFetcher->>TagMetadata: create TagMetadata for matching architecture
TagFetcher->>TagFetcher: add tag to valid_images
end
end
Class diagram for TagMetadata creation in DockerHub workaroundclassDiagram
class TagMetadata {
+repository: str
+image: str
+tag: str
+last_modified: str
+sha: str | None
+digest: str
}
class TagFetcher {
+fetch_remote_tags(repository: str, local_images: List[str])
}
TagFetcher --> TagMetadata : creates
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey there - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `core/services/versionchooser/test_versionchooser.py:272` </location>
<code_context>
+ assert "master" in tag_names, f"Expected to find 'master' tag in tags: {tag_names[:10]}"
+
+ # Errors should be empty string if successful
+ if errors:
+ print(f"Non-fatal errors during fetch: {errors}")
+
+ except Exception as e:
</code_context>
<issue_to_address>
Test does not assert on non-fatal errors returned from fetcher.
Add an assertion to check that errors are empty, or document why non-fatal errors are allowed, to clarify test expectations.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
# Errors should be empty string if successful
if errors:
print(f"Non-fatal errors during fetch: {errors}")
=======
# Errors should be empty string if successful
assert not errors, f"Non-fatal errors during fetch: {errors}"
>>>>>>> REPLACE
</suggested_fix>
### Comment 2
<location> `core/services/versionchooser/test_versionchooser.py:275` </location>
<code_context>
+ if errors:
+ print(f"Non-fatal errors during fetch: {errors}")
+
+ except Exception as e:
+ # If this fails due to network issues, skip the test
+ pytest.skip(f"Could not fetch tags from DockerHub, likely network issue: {e}")
</code_context>
<issue_to_address>
Test skips on any exception, potentially hiding real bugs.
Limit exception handling to network-related errors, and log unexpected exceptions for further review.
Suggested implementation:
```python
except requests.exceptions.RequestException as e:
# If this fails due to network issues, skip the test
pytest.skip(f"Could not fetch tags from DockerHub, likely network issue: {e}")
except Exception as e:
print(f"Unexpected exception during DockerHub tag fetch: {e}")
raise
```
```python
import requests
```
</issue_to_address>
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
here's only the list of files diff: Untracked Python dependecies upgrades:
|
@joaoantoniocardoso are we good to merge ? My idea is to release a stable for 1.3 with this patch |
Code-wise yes, but I haven't tested it, and we must. |
This is a backport of #3490 into 1.3
Summary by Sourcery
Backport the DockerHub workaround to handle missing images and add integration tests for tag fetching
Enhancements:
Tests: