mirror of
https://github.com/ansible-collections/community.docker.git
synced 2025-12-16 11:58:43 +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 | ||
| compose_v2_test_cases.py | ||
| test__compose_v2.py | ||
| test__copy.py | ||
| test__image_archive.py | ||
| test__logfmt.py | ||
| test__scramble.py | ||
| test__util.py | ||