mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 12:21:26 -07:00
[docker] support the lookup of images by digest (#56649)
* [docker] images: add support for lookup by sha256 digest Signed-off-by: Jakob Ackermann <das7pad@outlook.com> * [tests] docker image by digest: work on a minimal test case Signed-off-by: Jakob Ackermann <das7pad@outlook.com> * [docker] group branch conditions per lookup Co-Authored-By: Felix Fontein <felix@fontein.de> * [misc] add a news fragment for the added digest lookup for docker images Signed-off-by: Jakob Ackermann <das7pad@outlook.com>
This commit is contained in:
parent
8e1dd58c2b
commit
3b4b2e5021
3 changed files with 49 additions and 1 deletions
|
@ -639,10 +639,12 @@ class AnsibleDockerClient(Client):
|
|||
images = response
|
||||
if tag:
|
||||
lookup = "%s:%s" % (name, tag)
|
||||
lookup_digest = "%s@%s" % (name, tag)
|
||||
images = []
|
||||
for image in response:
|
||||
tags = image.get('RepoTags')
|
||||
if tags and lookup in tags:
|
||||
digests = image.get('RepoDigests')
|
||||
if (tags and lookup in tags) or (digests and lookup_digest in digests):
|
||||
images = [image]
|
||||
break
|
||||
return images
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue