docker_image_build: work around strange behavior of docker buildx build when --output is provided (#1006)

* Work around strange behavior of docker buildx build when --output is provided.

* Adjust tests.

* Allow to pass multiple image names; correctly quote --output values.

* Return executed command.

* Adjust tests.
This commit is contained in:
Felix Fontein
2024-12-14 21:32:33 +01:00
committed by GitHub
parent 2e7b4e4605
commit 8616e7f6f2
4 changed files with 140 additions and 50 deletions
@@ -0,0 +1,10 @@
bugfixes:
- "docker_image_build - work around bug resp. very unexpected behavior in Docker buildx that overwrites
all image names in ``--output`` parameters if ``--tag`` is provided, which the module did by default
in the past. The module now only supplies ``--tag`` if ``outputs`` is empty. If ``outputs`` has entries,
it will add an additional entry with ``type=image`` if no entry of ``type=image`` contains the image name
specified by the ``name`` and ``tag`` options
(https://github.com/ansible-collections/community.docker/issues/1001, https://github.com/ansible-collections/community.docker/pull/1006)."
minor_changes:
- "docker_image_build - ``outputs[].name`` can now be a list of strings (https://github.com/ansible-collections/community.docker/pull/1006)."
- "docker_image_build - the executed command is now returned in the ``command`` return value in case of success and some errors (https://github.com/ansible-collections/community.docker/pull/1006)."