Extends the tag@digest fix to also cover push operations in docker_image.py.
The push_image() method was passing combined tag@digest format directly to
the Docker API's /images/{name}/push endpoint, which fails with
"invalid tag format" errors.
This fix:
1. Imports build_pull_arguments() into docker_image.py
2. Uses the helper in push_image() before calling the API
3. When tag contains @ (but isn't a pure digest), passes the full
reference as the image name and omits the tag parameter
This complements the previous fix to pull_image() methods, ensuring
both pull and push operations handle tag@digest correctly.
* 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.
In 3350283bcc, a subtle bug was introduced
by renaming this variable. For image builds that go down the `else`
branch, they never set this variable, which is then referenced below
when constructing the `params` dict. This results in a very confusing
bug from the Docker backend when trying to construct images:
> An unexpected Docker error occurred: 500 Server Error for
> http+docker://localhost/v1.51/build?t=molecule_local%2Fubuntu%3A24.04&q=False&nocache=False&rm=True&forcerm=True&pull=True&dockerfile=%2Fhome%2Fci%2F.ansible%2Ftmp%2Fmolecule.IaMj.install-github%2FDockerfile_ubuntu_24_04:
> Internal Server Error ("Cannot locate specified Dockerfile:
> /home/ci/.ansible/tmp/molecule.IaMj.install-github/Dockerfile_ubuntu_24_04")
Within the Docker daemon logs, the actual error presents itself like
this:
> level=debug msg="FIXME: Got an API for which error does not match any
> expected type!!!" error="Cannot locate specified Dockerfile:
> $HOME/.ansible/tmp/molecule.5DrS.install-package/Dockerfile_ubuntu_24_04"
> error_type="*errors.fundamental" module=api
Unfortunately, these are all red herrings and the actual cause of the
problem isn't Docker itself or the missing file, but in fact the
`docker_image` module not passing the correct parameter data here.
* Re-enable typing and improve config.
* Make mypy pass.
* Improve settings.
* First batch of types.
* Add more type hints.
* Fixes.
* Format.
* Fix split_port() without returning to previous type chaos.
* Continue with type hints (and ignores).
* Remove __metaclass__ = type.
for i in $(grep -REl '__metaclass__ = type' plugins/ tests/); do
sed -e '/^__metaclass__ = type/d' -i $i;
done
* Remove super arguments, and stop inheriting from object.
* Make all doc fragments, module utils, and plugin utils private.
* Remove some unused and no longer needed imports.
This hopefully also fixes the CI issues, which do not happen locally for me...
* Fix formatting.
* Try to make CI happy, again.
* Fix imports.
* Lint.
* Remove unicode text prefixes.
* Replace str.format() uses with f-strings.
* Replace % with f-strings, and do some cleanup.
* Fix wrong variable.
* Avoid unnecessary string conversion.
* Move licenses to LICENSES/, use SPDX-License-Identifier, mention all licenses in galaxy.yml.
* ignore.txt lines cannot be empty or contain only a comment.
* Cleanup.
* This particular __init__.py seems to be crucial.
* Try extra newline.
* Markdown comments are a real mess. I hope this won't break Galaxy...
* More licenses.
* Add sanity test.
* Skip some files, lint.
* Make sure there is a copyright line everywhere.
* Also check for copyright line in sanity tests.
* Remove colon after 'Copyright'.
* Normalize lint script.
* Avoid colon after 'Copyright' in lint script.
* Improve license checker.
* Update README.md
Co-authored-by: Maxwell G <9920591+gotmax23@users.noreply.github.com>
* Remove superfluous space.
* Referencing target instead of symlink
Co-authored-by: Maxwell G <9920591+gotmax23@users.noreply.github.com>
* Remove support for Ansible 2.9 and ansible-base 2.10.
* Remove Ansible 2.9 compatiblity code.
* Remove docker-compose from EE.
* Drop support for Python 2.6. Stop advertising docker-py for Python 2.6.
* Drop support for API versions 1.20 to 1.24.
* Fix condition.
* Prepare for distutils.version being removed in Python 2.12.
* Fix copy'n'paste error.
* Fix import.
* Re-add Loose prefix.
* Fix Python version typo.
* Improve formulation.
* Move message into own line.
* Fix casing, now that the object is no longer called Version.
* Add test to tag image with ID.
* Document that source=local also works with image IDs.
* Improve 'repository' documentation.
* Fix typo.
* Looks like a fix is needed to make this work.
* ...
* Avoid unnecessary re.search() calls.
* Add changelog fragment.
* Improve main description.
* Remove import.
* Allow to specify pull platform.
* Add basic test and document that the value is not used for idempotency at the moment.
* Fix pulling.
* Simplify code.
* Add API version for pull_platform.
* Move pull_platform into new pull option. Use apply_defaults=True to avoid some special logic.
* Add example.
* Remove apply_defaults=True.
* Avoid crash for docker-py < 2.5.0.
* Add warnings when load_image does not return a generator.
* Add test.
* Update plugins/modules/docker_image.py
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>