community.docker/plugins
Paul Berruti 21288cda7e Fix _image_lookup to handle combined tag@digest format
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.
2025-11-22 20:10:21 -08:00
..
action Python code modernization, 8/n (#1179) 2025-10-25 00:36:04 +00:00
connection Improve error/warning messages w.r.t. YAML quoting (#1205) 2025-11-16 12:32:51 +01:00
doc_fragments Drop support for docker-py. (#1171) 2025-10-15 21:55:07 +02:00
inventory Python code modernization, 8/n (#1179) 2025-10-25 00:36:04 +00:00
module_utils Fix _image_lookup to handle combined tag@digest format 2025-11-22 20:10:21 -08:00
modules Improve error/warning messages w.r.t. YAML quoting (#1205) 2025-11-16 12:32:51 +01:00
plugin_utils Add typing information, 1/2 (#1176) 2025-10-23 07:05:42 +02:00