mirror of
https://github.com/ansible-collections/community.docker.git
synced 2025-12-17 12:28:55 +00:00
The parse_repository_tag fix alone is not sufficient because Docker stores RepoTags and RepoDigests separately. When looking up an image with combined tag@digest (e.g., nginx:1.21@sha256:abc...), the _image_lookup function must split the combined format and match BOTH RepoTags (for the tag) AND RepoDigests (for the digest). Docker stores: - RepoTags: ["nginx:1.21"] - RepoDigests: ["nginx@sha256:abc..."] But NEVER stores the combined format. The previous code would construct: - lookup = "nginx:1.21@sha256:abc..." (never matches RepoTags) - lookup_digest = "nginx@1.21@sha256:abc..." (never matches RepoDigests) This fix: 1. Adds filter_images_by_tag() helper function to _util.py to avoid code duplication between _common.py and _common_api.py 2. Detects combined tag@digest format in the tag parameter 3. Splits into tag_part and digest_part 4. Constructs proper lookups for both RepoTags and RepoDigests 5. Requires BOTH to match for successful image lookup Without this fix, image_label_mismatch: ignore fails because the image cannot be found, resulting in no image labels being included in expected labels comparison. Includes comprehensive unit tests in test__util.py covering all scenarios including edge cases for multiple @ symbols and empty tag parts. |
||
|---|---|---|
| .. | ||
| _api | ||
| _module_container | ||
| _common_api.py | ||
| _common_cli.py | ||
| _common.py | ||
| _compose_v2.py | ||
| _copy.py | ||
| _image_archive.py | ||
| _logfmt.py | ||
| _platform.py | ||
| _scramble.py | ||
| _socket_handler.py | ||
| _socket_helper.py | ||
| _swarm.py | ||
| _util.py | ||
| _version.py | ||