Felix Fontein
0812d0b495
Support labels and shm_size for image build. Allow to specify (swap) memory limits in other units than bytes. ( #727 )
2023-12-28 21:42:55 +01:00
Felix Fontein
c4c347c626
Add proper platform handling. ( #705 )
2023-12-10 09:03:32 +01:00
Felix Fontein
4929ef603a
Integration tests: split up Docker setup, move docker_compose tests into own group ( #718 )
...
* Rename setup role.
* Create new CI group 6, and move docker_compose v1 tests into there.
* Split up Docker setup in integration tests.
* Change setup_docker_compose_v1 to install its own Docker SDK for Python.
* Docker SDK for Python not needed to set up registry or query host info.
2023-12-09 17:35:54 +01:00
Felix Fontein
b8afdc52b1
Fix bad expressions in tests. ( #711 )
...
ci_complete
2023-11-28 22:52:43 +01:00
Felix Fontein
1c66f880ee
Fix typos, improve markup, improve scenario guide ( #699 )
...
* Fix typos.
* Improve markup.
* Mention missing 'new' modules in scenario guide.
2023-10-29 08:30:24 +01:00
Felix Fontein
4d9b85c975
Update vendored Docker SDK for Python code ( #694 )
...
* vendored Docker SDK for Python code: volume: added support for bind propagation
https://docs.docker.com/storage/bind-mounts/#configure-bind-propagation
Cherry-picked from https://github.com/docker/docker-py/commit/bea63224e028226085c85caecace6480fe0aa6b0
Co-authored-by: Janne Jakob Fleischer <janne.fleischer@ils-forschung.de >
Co-authored-by: Milas Bowman <milas.bowman@docker.com >
* vendored Docker SDK for Python code: fix: eventlet compatibility
Check if poll attribute exists on select module instead of win32 platform check
The implementation done in #2865 is breaking usage of docker-py library within eventlet.
As per the Python `select.poll` documentation (https://docs.python.org/3/library/select.html#select.poll ) and eventlet select removal advice (eventlet/eventlet#608 (comment)), it is preferable to use an implementation based on the availability of the `poll()` method that trying to check if the platform is `win32`.
Fixes https://github.com/docker/docker-py/issues/3131
Cherry-picked from https://github.com/docker/docker-py/commit/78439ebbe1aae77ff0fd9b666894d80807182e28
Co-authored-by: Mathieu Virbel <mat@meltingrocks.com >
* vendored Docker SDK for Python code: fix: use response.text to get string rather than bytes
Adjusted from https://github.com/docker/docker-py/commit/0618951093bf3116af482c6dfb983219c5684343
Co-authored-by: Mehmet Nuri Deveci <5735811+mndeveci@users.noreply.github.com >
Co-authored-by: Milas Bowman <milas.bowman@docker.com >
* vendored Docker SDK for Python code: Fix missing asserts or assignments
Cherry-picked from https://github.com/docker/docker-py/commit/0566f1260cd6f89588df2128ec4e86e8266e5d74
Co-authored-by: Aarni Koskela <akx@iki.fi >
---------
Co-authored-by: Janne Jakob Fleischer <janne.fleischer@ils-forschung.de >
Co-authored-by: Milas Bowman <milas.bowman@docker.com >
Co-authored-by: Mathieu Virbel <mat@meltingrocks.com >
Co-authored-by: Mehmet Nuri Deveci <5735811+mndeveci@users.noreply.github.com >
Co-authored-by: Aarni Koskela <akx@iki.fi >
2023-10-08 18:16:27 +02:00
Felix Fontein
2c633dadeb
CI: ansible-core devel drops support for Python 2.7 and 3.6 ( #691 )
...
* ansible-core devel drops support for Python 2.7 and 3.6.
* Force PyYAML 5.3.1 on Alpine.
2023-10-04 23:22:08 +02:00
Felix Fontein
d9f49fc073
Add ansible-core 2.16 to the matrix. ( #686 )
2023-09-19 17:51:26 +02:00
Felix Fontein
92fc542c00
Make unit tests work with Python 3.12. ( #673 )
2023-07-23 22:33:07 +02:00
Felix Fontein
017536953a
Force PyYAML to 5.3.1. ( #669 )
2023-07-19 15:57:00 +02:00
Felix Fontein
0a8f3fa7d6
Remove no longer needed ignore. ( #668 )
2023-07-15 12:40:52 +02:00
Felix Fontein
024bdec919
Use semantic markup ( #645 )
...
* Use semantic markup.
* Linting.
* Define docsite targets.
* Forgot one env var.
* Add array stubs.
2023-06-22 07:01:31 +02:00
Felix Fontein
3f9f41e5a9
SuSE: install docker-compose v1 from pip instead of system packages. ( #650 )
...
The system package switched to docker-compose v2.
2023-06-20 07:58:54 +02:00
Felix Fontein
74b70f81c8
Switch to Ansible Galaxy compatible requirements files for tests. ( #633 )
2023-05-21 13:54:35 +02:00
Felix Fontein
39f2e9b9c4
Make compatible with requests 2.29.0 and urllib3 2.0 ( #613 )
...
* Make compatible with requests 2.29.0.
* This fix should also work with urllib3 2.0 according to urllib3 maintainer.
* Add changelog fragment.
* We still need the constraint for CI until Docker SDK for Python has a new release with a fix.
* Make modifications to response_class as small as possible.
* Revert "We still need the constraint for CI until Docker SDK for Python has a new release with a fix."
This reverts commit 698d544a1e08308e8bf8b4e56ab78c5079f9a17b.
* The pip coming with the ansible-core 2.11 alpine3 image seems to be too old.
2023-05-05 22:09:02 +02:00
Felix Fontein
054353bb14
Simplify test setup. ( #615 )
2023-05-03 19:39:04 +02:00
Felix Fontein
088cbaed4e
Restrict requests to < 2.29.0 ( #612 )
...
* Restrict requests to < 2.29.0.
* Also avoid urllib3, which gets installed in some cases even though it shouldn't.
2023-04-29 16:25:07 +02:00
Felix Fontein
9e1a0a6fb8
Do extra docs validation; explicitly disallow semantic markup in docs ( #607 )
...
* Do extra docs validation. Explicitly disallow semantic markup in docs.
* Forgot to add new requirement.
* Improve test.
* TEMP - make CI fail.
* Revert "TEMP - make CI fail."
This reverts commit d381f1a431 .
* Remove unnecessary import.
* Make sure ANSIBLE_COLLECTIONS_PATH is set.
* Make sure sanity tests from older Ansible versions don't complain.
2023-04-16 18:18:12 +02:00
Felix Fontein
5d61cb2b8d
Update CI matrix: add stable-2.15 ( #600 )
...
* Add ignore files for bumped devel version.
* Update CI matrix.
2023-04-04 06:12:39 +00:00
Felix Fontein
d0a3e587a5
More true/false normalization. ( #597 )
2023-03-06 22:17:13 +01:00
Felix Fontein
08bfcf7e5f
docker_prune: correctly return 'changed' result ( #593 )
...
* Correctly return 'changed' status.
* Extend tests.
* Fix typo.
2023-02-24 17:24:16 +01:00
Felix Fontein
dd19db8c8f
Normalize bools in tests. ( #589 )
2023-02-15 22:29:41 +01:00
Felix Fontein
449b91d489
Remove unnecessary test imports. ( #583 )
2023-02-12 20:59:51 +01:00
Kristof Mattei
d2f551fc5d
fix: fix tmpfs_size and tmpfs_mode not being set ( #580 )
...
* fix: fix tmpfs_size and tmpfs_mode not being set
* fix: wrong file
* fix: add changelog fragment
* fix: update changelog fragment to match formatting
Co-authored-by: Felix Fontein <felix@fontein.de >
---------
Co-authored-by: Felix Fontein <felix@fontein.de >
2023-02-10 14:05:09 +01:00
Felix Fontein
3a1bfc4be2
CI: Make tests work with Docker API version 1.42 ( #576 )
...
* Make tests work with API version 1.42.
* Make sure anonymous volume is separated from container a bit earlier.
* Another try.
2023-02-04 22:16:25 +01:00
Felix Fontein
d57b26269a
Looks like BuilderSize was never documented and eventually got removed. Replace with something that is documented ( https://docs.docker.com/engine/api/v1.42/#tag/System/operation/SystemDataUsage ). ( #569 )
2023-02-03 11:33:29 +01:00
Felix Fontein
a78bd6f443
Fix check in SSH connection test ( #567 )
...
* Fix check.
* Adjust error check.
2023-01-22 19:11:52 +00:00
Felix Fontein
c0d9ca67c4
Restrict to old enough paramiko on RHEL 8 or other systems using Python 3.6. ( #563 )
2023-01-22 17:15:27 +01:00
Felix Fontein
c7cbec0163
docker_plugin: do not crash when plugin doesn't exist ( #553 )
...
* Do not crash when plugin doesn't exist.
* Improve style.
Co-authored-by: Brian Scholer <1260690+briantist@users.noreply.github.com >
Co-authored-by: Brian Scholer <1260690+briantist@users.noreply.github.com >
2023-01-13 20:49:06 +01:00
Felix Fontein
e198e4ab43
Add docker_container_copy_into module ( #545 )
...
* Move copying functionality to module_utils.
* Add docker_container_copy_into module.
* Use new module in other tests.
* Fix copyright and attributes.
* Improve idempotency, improve stat code.
* Document and test when a stopped container works.
* Improve owner/group detection error handling when container is stopped.
* Fix formulation.
Co-authored-by: Brian Scholer <1260690+briantist@users.noreply.github.com >
* Improve file comparison.
* Avoid reading whole file at once.
* Stream when fetching files from daemon.
* Fix comment.
* Use read() instead of read1().
* Stream files when copying into container.
* Linting.
* Add force parameter.
* Simplify library code.
* Linting.
* Add content and content_is_b64 options.
* Make force=false work as for copy module: only copy if the destination does not exist.
* Improve docs.
* content should be no_log.
* Implement diff mode.
* Improve error handling.
* Lint and improve.
* Set owner/group ID to avoid ID lookup (which fails in paused containers).
* Apply suggestions from code review
Co-authored-by: Brian Scholer <1260690+briantist@users.noreply.github.com >
Co-authored-by: Brian Scholer <1260690+briantist@users.noreply.github.com >
2023-01-09 11:52:29 +01:00
Felix Fontein
134d32cae6
CI: improve Docker setup ( #550 )
...
* Cache has already been updated a few lines before.
* When skipping Docker cleanup, create flag to avoid the expensive part of the setup (including package manager cache update) to be run again.
2023-01-08 22:21:59 +01:00
Felix Fontein
3470e5effb
Add setup role for Docker Compose v2. ( #542 )
2022-12-30 15:19:20 +01:00
Felix Fontein
c6aca384ed
Delete stopped container as well.
2022-12-28 16:33:45 +01:00
Felix Fontein
faa7fef504
docker_host_info: allow to list all containers ( #538 )
...
* Allow to list all containers.
* Fix typo.
2022-12-27 21:39:17 +01:00
Felix Fontein
02915cd22c
Improve CI ( #528 )
...
* Update CI scripts to be more close to the ones in ansible-core.
* Extend CI matrix.
* Make sure that docker daemon is running (when not in a container).
* Make sure that connection plugin tests do not uninstall Docker daemon.
* Check some conditions.
* Fix error ignores.
* Skip SSH test on Alpine VMs.
* Take care of more errors.
* Adjust for more errors.
* Improve conditions.
* Remove new entries from CI matrix; make CI matrix nicer.
2022-12-11 17:30:37 +01:00
Felix Fontein
6e04e1f172
Handle ansible_default_ipv4 not there in tests. ( #514 )
2022-12-01 00:02:02 +01:00
iamjpotts
166d485216
Make image archive/save idempotent, using image id and repo tags as keys ( #500 )
2022-11-30 23:45:36 +01:00
Felix Fontein
c2d84efccb
Make current_container_facts work with newer Docker versions and latest ansible-test container changes ( #510 )
...
* Add more debug output.
* Add basic integration test.
* Split into lines.
* Fix docker detection, add podman detection.
ci_complete
* Improve regular expression.
* Document that this module is trying its best, but might not be perfect.
* Update comment.
2022-11-30 22:25:33 +01:00
Felix Fontein
f17e6d52bd
Allow changelog fragments with .yaml ending.
2022-11-17 12:41:54 +01:00
Felix Fontein
5b31f17016
Add image_name_mismatch option. ( #488 )
2022-11-01 19:48:58 +00:00
Felix Fontein
51d5744cb0
docker_container: deprecate ignore_image and purge_networks ( #487 )
...
* Deprecate ignore_image and purge_networks.
* Fix YAML.
* Simple replacement doesn't work in this case.
2022-11-01 19:57:56 +01:00
Felix Fontein
ac606cd2bf
Change CI group identifiers. ( #484 )
2022-10-10 22:39:27 +02:00
Felix Fontein
e412c0d081
Add stable-2.14 to CI. ( #478 )
2022-09-21 08:16:55 +02:00
Felix Fontein
68ea9c5f41
Make reuse conformant ( #462 )
...
* Add .license files.
* Add reuse test.
* Update README.
* Add changelog fragment.
* Normalize licenses extra sanity test.
* Declare REUSE conformance.
* Update README.
2022-08-21 08:29:15 +02:00
Felix Fontein
d8297df7d0
Fix docker_image's build.args ( #456 )
...
* Add tests for build.args.
* Fix bug: store build args in correct dict
* Add changelog fragment.
* Update copyright notice.
2022-08-16 22:37:51 +02:00
Felix Fontein
f7cf12555c
docker_container: fix env_file option ( #452 )
...
* Add better tests for env and env_file.
* Make sure that non-container options are also passed to preprocessing code.
* Add changelog fragment.
* Add env_file override test.
2022-08-15 07:45:59 +02:00
Felix Fontein
a50257381f
Fix docker_plugin crash when handling plugin options ( #447 )
...
* Fix docker_plugin crash when handling plugin options.
* Try to add tests.
2022-08-12 19:29:45 +02:00
Felix Fontein
74134eda33
Fix docker_container tests ( #441 )
...
* Add diff output to figure out a bit more why the test fails.
* Make sure that both images have been pulled in advance.
* Dump the correct image.
* Allow tty test to fail in certain circumstances.
2022-08-08 23:23:23 +02:00
Felix Fontein
ae708a7333
Vendored Docker SDK for Python updates ( #434 )
...
* utils: fix IPv6 address w/ port parsing
This was using a deprecated function (`urllib.splitnport`),
ostensibly to work around issues with brackets on IPv6 addresses.
Ironically, its usage was broken, and would result in mangled IPv6
addresses if they had a port specified in some instances.
Usage of the deprecated function has been eliminated and extra test
cases added where missing. All existing cases pass as-is. (The only
other change to the test was to improve assertion messages.)
Cherry-picked from
https://github.com/docker/docker-py/commit/f16c4e1147c81afd822fe72191f0f720cb0ba637
Co-authored-by: Milas Bowman <milas.bowman@docker.com >
* client: fix exception semantics in _raise_for_status
We want "The above exception was the direct cause of the following exception:" instead of "During handling of the above exception, another exception occurred:"
Cherry-picked from
https://github.com/docker/docker-py/commit/bb11197ee3407798a53c50e43aa994fe8cd9c8e7
Co-authored-by: Maor Kleinberger <kmaork@gmail.com >
* tls: use auto-negotiated highest version
Specific TLS versions are deprecated in latest Python, which
causes test failures due to treating deprecation errors as
warnings.
Luckily, the fix here is straightforward: we can eliminate some
custom version selection logic by using `PROTOCOL_TLS_CLIENT`,
which is the recommended method and will select the highest TLS
version supported by both client and server.
Cherry-picked from
https://github.com/docker/docker-py/commit/56dd6de7dfad9bedc7c8af99308707ecc3fad78e
Co-authored-by: Milas Bowman <milas.bowman@docker.com >
* transport: fix ProxyCommand for SSH conn
Cherry-picked from
https://github.com/docker/docker-py/commit/4e19cc48dfd88d0a9a8bdbbe4df4357322619d02
Co-authored-by: Guy Lichtman <glicht@users.noreply.github.com >
* ssh: do not create unnecessary subshell on exec
Cherry-picked from
https://github.com/docker/docker-py/commit/bb40ba051fc67605d5c9e7fd1eb5f9aa3e0fb501
Co-authored-by: liubo <liubo@uniontech.com >
* ssh: reject unknown host keys when using Python SSH impl
In the Secure Shell (SSH) protocol, host keys are used to verify the identity of remote hosts. Accepting unknown host keys may leave the connection open to man-in-the-middle attacks.
Do not accept unknown host keys. In particular, do not set the default missing host key policy for the Paramiko library to either AutoAddPolicy or WarningPolicy. Both of these policies continue even when the host key is unknown. The default setting of RejectPolicy is secure because it throws an exception when it encounters an unknown host key.
Reference: https://cwe.mitre.org/data/definitions/295.html
NOTE: This only affects SSH connections using the native Python SSH implementation (Paramiko), when `use_ssh_client=False` (default). If using the system SSH client (`use_ssh_client=True`), the host configuration
(e.g. `~/.ssh/config`) will apply.
Cherry-picked from
https://github.com/docker/docker-py/commit/d9298647d91c52e1ee9ac448e43a7fea1c69bdbe
Co-authored-by: Audun Nes <audun.nes@gmail.com >
* lint: fix deprecation warnings from threading package
Set `daemon` attribute instead of using `setDaemon` method that
was deprecated in Python 3.10.
Cherry-picked from
https://github.com/docker/docker-py/commit/adf5a97b1203623ae47bf7aa1367b6bb7c261980
Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com >
* api: preserve cause when re-raising error
Use `from e` to ensure that the error context is propagated
correctly.
Cherry-picked from
https://github.com/docker/docker-py/commit/05e143429e892fb838bbff058391456ba3d0a19c
Co-authored-by: Milas Bowman <milas.bowman@docker.com >
* build: trim trailing whitespace from dockerignore entries
Cherry-picked from
https://github.com/docker/docker-py/commit/3ee3a2486fe75ed858f8a3defe0fc79b2743d5df
Co-authored-by: Clément Loiselet <clement.loiselet@capgemini.com >
* Improve formulation, also mention the security change as a breaking change.
Co-authored-by: Milas Bowman <milas.bowman@docker.com >
Co-authored-by: Maor Kleinberger <kmaork@gmail.com >
Co-authored-by: Guy Lichtman <glicht@users.noreply.github.com >
Co-authored-by: liubo <liubo@uniontech.com >
Co-authored-by: Audun Nes <audun.nes@gmail.com >
Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com >
Co-authored-by: Clément Loiselet <clement.loiselet@capgemini.com >
2022-07-31 17:09:18 +02:00
Maxwell G
a33e51e04a
Prefer unitest.mock by universally using compat.mock ( #433 )
...
* Prefer unitest.mock by using compat.mock
`mock` is a backport of the `unittest.mock` module from the stdlib, and
there's no reason to use it on newer Python versions. `mock` is deprecated
in Fedora, so I figured I'd propose this here before downstream patching
our ansible-collection-community-docker package.
* Remove compat.mock code for older Python 3 versions
This removes compatibility for older versions of Python 3 that are no
longer supported.
2022-07-31 16:39:31 +02:00