mirror of
https://github.com/ansible-collections/community.docker.git
synced 2026-07-29 03:46:55 +00:00
docker_image(_push): fix push detection (#1199)
* Fix IP address retrieval for registry setup. * Adjust push detection to Docker 29. * Idempotency for export no longer works. * Disable pull idempotency checks that play with architecture. * Add more known image IDs. * Adjust load tests. * Adjust error message check. * Allow for more digests. * Make sure a new enough cryptography version is installed.
This commit is contained in:
@@ -21,6 +21,8 @@ description:
|
||||
notes:
|
||||
- Building images is done using Docker daemon's API. It is not possible to use BuildKit / buildx this way. Use M(community.docker.docker_image_build)
|
||||
to build images with BuildKit.
|
||||
- Exporting images is generally not idempotent. It depends on whether the image ID equals the IDs found in the generated tarball's C(manifest.json).
|
||||
This was the case with the default storage backend up to Docker 28, but seems to have changed in Docker 29.
|
||||
extends_documentation_fragment:
|
||||
- community.docker._docker.api_documentation
|
||||
- community.docker._attributes
|
||||
@@ -803,7 +805,7 @@ class ImageManager(DockerBaseClass):
|
||||
if line.get("errorDetail"):
|
||||
raise RuntimeError(line["errorDetail"]["message"])
|
||||
status = line.get("status")
|
||||
if status == "Pushing":
|
||||
if status in ("Pushing", "Pushed"):
|
||||
changed = True
|
||||
self.results["changed"] = changed
|
||||
except Exception as exc: # pylint: disable=broad-exception-caught
|
||||
|
||||
@@ -28,7 +28,13 @@ attributes:
|
||||
diff_mode:
|
||||
support: none
|
||||
idempotent:
|
||||
support: full
|
||||
support: partial
|
||||
details:
|
||||
- Whether the module is idempotent depends on the storage API used for images,
|
||||
which determines how the image ID is computed. The idempotency check needs
|
||||
that the image ID equals the ID stored in archive's C(manifest.json).
|
||||
This seemed to have worked fine with the default storage backend up to Docker 28,
|
||||
but seems to have changed in Docker 29.
|
||||
|
||||
options:
|
||||
names:
|
||||
|
||||
@@ -159,7 +159,7 @@ class ImagePusher(DockerBaseClass):
|
||||
if line.get("errorDetail"):
|
||||
raise RuntimeError(line["errorDetail"]["message"])
|
||||
status = line.get("status")
|
||||
if status == "Pushing":
|
||||
if status in ("Pushing", "Pushed"):
|
||||
results["changed"] = True
|
||||
except Exception as exc: # pylint: disable=broad-exception-caught
|
||||
if "unauthorized" in str(exc):
|
||||
|
||||
@@ -219,6 +219,7 @@ class ImageRemover(DockerBaseClass):
|
||||
|
||||
elif is_image_name_id(name):
|
||||
deleted.append(image["Id"])
|
||||
# TODO: the following is no longer correct with Docker 29+...
|
||||
untagged[:] = sorted(
|
||||
(image.get("RepoTags") or []) + (image.get("RepoDigests") or [])
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user