Commit Graph

363 Commits

Author SHA1 Message Date
Felix Fontein
e0b9c45579
Re-enable RHEL 8 in CI (#1075)
* Re-enable RHEL 8 in CI.

* Skip podman on RHEL 8.
2025-04-28 21:42:31 +02:00
Felix Fontein
ad989c1942
docker_container_copy_into: add mode_parse option (#1074)
* Add mode_parse option.

* Make yamllint config strict.

* Lint.
2025-04-28 20:46:11 +02:00
Felix Fontein
424b39fe36 Since we require ansible-core >= 2.15, nothing before Python 2.7 is supported and used in tests anyway. 2025-04-27 12:24:53 +02:00
Felix Fontein
961acd9120 Remove no longer needed file. 2025-04-27 12:24:10 +02:00
Felix Fontein
2487d1a0bf Fix linting errors. 2025-04-26 12:39:00 +02:00
Felix Fontein
e20118b68f
Run extra sanity tests with nox. (#1068) 2025-04-19 17:54:12 +02:00
Felix Fontein
8694f488d7
CI: fix certificates for HTTPS connection tests (#1066)
* Try to fix CA cert for HTTPS connection tests.

* Try to fix leaf certificate.

* Add more properties.
2025-04-11 14:09:01 +02:00
Felix Fontein
a1e9412bed
Use new tools from community.internal_test_tools. (#1061) 2025-03-22 11:59:27 +01:00
Felix Fontein
635716c07b
docker_compose_v2: use --yes when available instead of -y (#1060)
* Use --yes if available.

* Add smoke test.
2025-03-21 22:05:10 +01:00
Felix Fontein
9730b2a3c3
Use shared unit test utils from community.internal_test_tools. (#1056) 2025-03-12 21:39:05 +01:00
Felix Fontein
9972eee967 Make sure that community.internal_test_tools is installed for unit tests. 2025-03-12 21:00:09 +01:00
Felix Fontein
fdb97428a3
Fix/improve tests (#1052)
* Improve unit test condition.

* Improve/fix tests.
2025-03-08 09:54:41 +01:00
Felix Fontein
22ab85fe2b
docker_context_info: fix some aspects (#1043)
* Extend docker_context_info tests.

* Fix a bug in the context code.

* Fix TLS handling for contexts.

* Adjust code to fix tests.
2025-02-10 23:54:36 +01:00
Felix Fontein
20042ea780
Add basic podman tests to CI (#1040)
* Setup podman and run some basic tests with it.

* Clean up Docker setup.
2025-02-10 23:19:54 +01:00
Felix Fontein
3b6068e44b
Add docker_context_info module (#1039)
* Vendor parts of the Docker SDK for Python

This is a combination of the latest git version
(db7f8b8bb6)
with some fixes to make it compatible with Python 2.7
and adjusting some imports.

* Polishing.

* Fix bug that prevents contexts to be found when no Docker config file is present.

Ref: https://github.com/docker/docker-py/issues/3190

* Linting.

* Fix typos.

* Adjust more to behavior of Docker CLI.

* Add first iteration of docker_context_info module.

* Improvements.

* Add basic CI.

* Add caveat on contexts[].config result.
2025-02-10 21:59:05 +01:00
Felix Fontein
bcd6e57450
Vendored Docker SDK for Python code: remove unused constants (#1037)
* Remove constants that are never used.

* Adjust unit tests.
2025-02-01 23:14:19 +01:00
Felix Fontein
9cc70f5202
Fix label sanitization error handling. (#1029) 2025-01-22 20:45:08 +00:00
Felix Fontein
9e26c4794e
docker_compose_v2: fix tests (#1027)
* Since docker-compose 2.32.2 present_3 is no longer changed.

This has been caused by https://github.com/docker/compose/pull/12442,
since that PR removes the "building" event.

* Remove deprecated 'version' fields.
2025-01-14 21:17:05 +01:00
Felix Fontein
993d66971d
CI: Try to get more targets for SSH connection test (#1026)
* Try to get more targets for SSH connection test.

* Install paramiko from system repos on CentOS 7.
2025-01-11 12:54:11 +01:00
Felix Fontein
29ff1241ce
Use multiple YAML documents for inventory plugin examples. (#1023) 2025-01-07 21:21:01 +01:00
Felix Fontein
1a218f3c5e Improve extra sanity test for docker action group. 2025-01-03 14:50:33 +01:00
Felix Fontein
8616e7f6f2
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.
2024-12-14 21:32:33 +01:00
Felix Fontein
2e7b4e4605
docker_compose_v2: add ignore_build_events option; ignore build events by default (#1011)
* Add ignore_build_events option.

* Adjust docs and tests.

* Switch default to true.

* Remove unnecessary parts from tests.
2024-12-14 19:54:40 +01:00
Maksim Vorobyev
e19812917d
Add 'ingress' option to docker_network module (#999)
* Add 'ingress' option to docker_network module

* sanity fixes

* add changelog fragment

* Update plugins/modules/docker_network.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update changelogs/fragments/999-add-ingress-option-to-docker_network-module.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/docker_network.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* move 'ingress' tests to overlay.yml

* move Sworm init and Swarm cleanup to block

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
2024-12-04 21:39:09 +01:00
Felix Fontein
78bdccd453
Correctly set can_talk_is_docker. (#995) 2024-11-23 13:19:32 +01:00
Felix Fontein
a740cfa0c4
Add more tests. (#980) 2024-10-19 22:07:06 +02:00
Felix Fontein
f7823ea626
Prepare 4.0.0 release. (#971) 2024-10-18 21:01:49 +02:00
Felix Fontein
28e87f4602
Compose v2: improve parsing of dry-run building JSON events (#976)
* Catch more warnings that shouldn't be there.

* Add explicit handling of dry-run image build JSON events.

These produce some one-off ID values that don't make any sense as ID values.
2024-10-14 20:56:49 +02:00
Felix Fontein
423a9bbf61
Add Docker Compose v2 exec and run modules. (#969) 2024-09-27 13:00:48 +03:00
Felix Fontein
d478174786
Add stable-2.18 to CI. (#970) 2024-09-24 13:46:51 +03:00
x4e-jonas
d8cefc4190
Fix typo in Docker connection tests. (#964)
Co-authored-by: x4e-jonas <x4e-jonas@users.noreply.github.com>
2024-09-09 15:28:17 +02:00
Felix Fontein
3cc27ecd65
Handle yet another random unstructured error output. (#949) 2024-08-07 15:58:23 +02:00
Felix Fontein
41445def33
Upload Docker image used for connection tests to GHCR. (#944) 2024-07-25 20:46:43 +00:00
Felix Fontein
c3aceebd7d
Docker* connection plugins: add working_dir and privileged options (#943)
* Add working_dir option.

* Add privileged option.

* Add basic tests.

* Also test privileged.
2024-07-25 20:35:32 +00:00
Felix Fontein
45b2531129
docker_compose_v2* modules: use --progress json for Compose 2.29.0+ (#931)
* Use --progress json for Compose 2.29.0+.

* Add changelog fragment.

* Fix/improve handling of warnings.

* Improve parsing of warnings and some one-off messages.

* Improve warnings.

* Handle tail messages.

* Fix bug in regular event parsing.
2024-07-25 18:33:42 +02:00
Felix Fontein
a30fd93a44
Check for unparsable messages. (#932) 2024-07-17 23:54:31 +02:00
Felix Fontein
4b7e74b75e
docker_container: allow to wait for a container to become healthy (#921)
* Allow to wait for a container to become healthy.

* Improve wording.

Co-authored-by: Don Naro <dnaro@redhat.com>

* Improve explanation.

---------

Co-authored-by: Don Naro <dnaro@redhat.com>
2024-07-09 20:07:00 +02:00
Felix Fontein
ec37166a6c
Use registry image from ghcr.io. (#927) 2024-07-08 19:22:18 +00:00
Felix Fontein
8e8a091469
Get rid of hello-world image, 2/2 (#925)
* Use our image for container platform test.

* Remove docker_test_image_hello_world_platform image.
2024-07-08 09:27:27 +02:00
Felix Fontein
f9461bb441
Get rid of hello-world image, 1/2 (#924)
* Use our image for pull test.

* Add 386 versions of the images.
2024-07-08 09:04:06 +02:00
Felix Fontein
8efbd560f9 Use variable instead of image directly. 2024-07-07 23:20:42 +02:00
Felix Fontein
7ec56d33cb Fix health check so that Docker also likes it... 2024-07-07 22:30:05 +02:00
Felix Fontein
569880486f
Improve health check image. (#919) 2024-07-07 21:19:26 +02:00
Felix Fontein
f69a29403b
Add health check test image. (#918) 2024-07-07 19:31:16 +02:00
Felix Fontein
48c0cdf2c5
Imporve parsing of skipped messages. (#916) 2024-07-06 21:10:39 +02:00
Fran Jurinec
9b5dbd4543
Add support from device_cgroup_rules parameter (#910) 2024-07-04 09:51:32 +02:00
Felix Fontein
1713995bfc
Fix CI for CentOS 7. (#908) 2024-07-01 13:51:02 +02:00
Andrew Dawes
d98850e9e9
Support ansible-test integration tests for arm64 (#906)
* Support ansible-test integration for arm64

* Replace set_fact with inline templated conditional
2024-06-30 14:07:25 +02:00
Felix Fontein
2ce838ab92
Use new images for export/import tests. (#905) 2024-06-29 19:20:24 +02:00
Felix Fontein
81cabbf697
CI: Run some tests with the latest development versions of Docker SDK for Python, requests, and urllib3 (#902)
* Run some tests with the latest development versions of Docker SDK for Python, requests, and urllib3.

* Use LooseVersion instead of StrictVersion to parse urllib3 versions.
2024-06-29 18:57:08 +02:00
Felix Fontein
7efc6381d0
CI: use new container images for Compose v2 pull tests (#900)
* Use simple-1 image instead of Alpine image for docker_compose_v2_pull tests.

* Use simple-1 image instead of Alpine image for docker_compose_v2 pull tests.
2024-06-29 11:43:00 +02:00
Felix Fontein
d334c2362f
Create helper OCI images for use in CI. (#899) 2024-06-28 22:59:20 +02:00
Felix Fontein
ace4ee4f70
Make sure that Docker SDK for Python is installed for docker_stack* tests. (#896) 2024-06-28 16:46:26 +02:00
Felix Fontein
08063a0439
Skip certain tests on Docker 27.0.0+. (#893) 2024-06-28 07:40:45 +02:00
Felix Fontein
691bc6de72
Docker Compose v1 tests: restrict API version to 1.44 if default API version is 1.45+ (#881)
* Restrict API version to 1.44 if default API version is 1.45+.

* Set COMPOSE_API_VERSION if api_version is provided.

* Add changelog.
2024-06-14 08:02:12 +02:00
Felix Fontein
fd5110c94c
Fix shellcheck errors. (#880) 2024-06-13 21:39:07 +02:00
Felix Fontein
0616fb12df
Try to fix docker-compose v1 tests on Arch. (#879) 2024-06-10 21:19:04 +02:00
Felix Fontein
7867390473
Force requests<2.32.0 for docker-compose. (#867) 2024-05-22 07:43:03 +02:00
Felix Fontein
2eb2c9febf
Add test for unsafe plugin util. (#856) 2024-05-12 01:00:50 +02:00
Felix Fontein
f2a5d6f872
docker_image_build: allow to specify multiple platforms, allow to specify secrets and outputs (#852)
* Add note on idempotency.

* Make platform a list of strings.

* Support specifying secrets.

* Add test for secrets.

* Support specifying outputs.

* Ignore invalid choices syntax for ansible-core <= 2.16.

It actually works with ansible-core 2.14+ (though not with <= 2.13),
but the sanity tests only accept it from 2.17 on.

* Only use --secret with type=env for buildx 0.6.0+, and multiple --output for buildx 0.13.0+.
2024-05-11 15:52:47 +02:00
Felix Fontein
e176a8a17b Improve tasks, show images before docker_compose_v2_pull tests. 2024-05-10 13:06:54 +02:00
Felix Fontein
f51ca84197
docker_prune: add new options for cleaning build caches (#845)
* Add new options for cleaning build caches to docker_prune.

* Add tests.
2024-05-09 17:12:36 +02:00
Florian
368d616229
Add sysctls option to docker_swarm_service (#836)
* add sysctls option to docker_swarm_service

* Add added version number

Co-authored-by: Felix Fontein <felix@fontein.de>

* version added -> 3.10.0

Co-authored-by: Felix Fontein <felix@fontein.de>

* changelog fragment for docker_swarm_service sysctls

* add minimal docker_py / docker_api versions to use for sysctls

* set expected sysctls to null on integration test

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
2024-04-30 22:44:25 +02:00
Felix Fontein
8ad45286a3
Remove unused code that relies on functionality deprecated in Python 3.12. (#834) 2024-04-15 11:21:46 +00:00
Felix Fontein
9e8c367c47
docker_compose_v2: allow to specify inline compose definitions (#832)
* Allow to specify inline compose definitions.

* Remove comma that trips Python 2.7.

* Add tests.

* Add PyYAML as EE dependency.

* Be more explicit on PyYAML.
2024-04-09 17:41:12 +02:00
Felix Fontein
9ff53bc143
CI: Add stable-2.17; copy ignore.txt files from 2.17 to 2.18; move stable-2.14 from AZP to GHA (#830)
* Add stable-2.17 to CI; copy ignore files from 2.17 to 2.18.

* Move stable-2.14 from AZP to GHA.
2024-04-03 08:32:28 +02:00
Felix Fontein
7d120ab42e
Ignore pylint warnings for construct that does not work with Python 2 (#821)
* Ignore pylint warnings for construct that does not work with Python 2.

* Revert "Ignore pylint warnings for construct that does not work with Python 2."

This reverts commit 92c19c78dc.

* Different approach: use ignore.txt since otherwise ansible-core 2.14 tests fail.
2024-03-23 12:28:38 +01:00
Felix Fontein
bf1281ae7f
Prevent RCE via inventory plugins (#815)
* Prevent RCE via inventory plugins.

* Do not make ansible_connection unsafe.

* Add test.
2024-03-14 20:08:41 +01:00
Felix Fontein
14e2f92974
Improve inventory integration tests. (#817) 2024-03-13 13:56:22 +01:00
Felix Fontein
4bab9a6b0e
Fix idempotency of docker_compose_v2_pull. (#814) 2024-03-13 13:20:11 +01:00
Felix Fontein
6600f501ae
Fix Python deps setup in callback/inventory tests. (#816) 2024-03-13 07:47:51 +01:00
Felix Fontein
6aea7efed9
Improve parsing of warnings and errors (#811)
* Add logfmt message parser.

* Parse logfmt formatted warnings.

* Follow-up for #810.

* Fix handling of warning and error messages.

* Make Python 2 compatible.

* Linting. Improving tests.
2024-03-03 13:38:55 +00:00
Felix Fontein
6f5d67860c
docker_compose_v2: ignore some pull events (#803)
* Ignore some pull events.

* Adjust tests.
2024-02-23 18:24:16 +01:00
Felix Fontein
6366464812
docker_container: allow pull=never, and make check mode behavior configurable (#797)
* Allow to configure behavior of pull=true in check mode.

* Change pull to option that accepts some strings as well, such as pull=never.

* Adjust values.
2024-02-14 22:49:22 +01:00
Felix Fontein
7b554082ea
Improve parsing. (#786) 2024-02-01 17:52:31 +00:00
Felix Fontein
c97ac2337f
Zuul third-party-check: disable ansible-doc part of galaxy-importer. (#781) 2024-01-27 14:49:28 +01:00
Felix Fontein
b5d085bb88
Parse build events from stderr. (#779) 2024-01-25 06:40:32 +01:00
Felix Fontein
b5391c7971
Add action group sanity test. (#777) 2024-01-24 08:25:17 +01:00
Felix Fontein
b2a79d9eb7
Add docker_image_export module (#774)
* Add docker_image_export module.

* Add basic tests.

* Add more seealsos.
2024-01-22 22:03:38 +01:00
Felix Fontein
648e0652d5
mac_address no longer works with Docker API v1.44+. (#764) 2024-01-20 14:06:29 +01:00
Felix Fontein
6082efc855
Improve docs sharing for docker_compose_v2* modules; fix examples and return docs for docker_compose_v2_pull (#761)
* Move more common documentation to docs fragment.

* Fix examples and return values for docker_compose_v2_pull.

* Remove ignore.
2024-01-17 07:53:44 +01:00
Felix Fontein
1c8272f821
Change Docker Stack modules to use common CLI module framework. (#745) 2024-01-14 08:54:06 +01:00
Felix Fontein
f04cdb7e06
Remove sanity ignore files for Ansible 2.9 and ansible-base 2.10. (#753) 2024-01-13 16:05:59 +01:00
Felix Fontein
f429017d94
Add inventory filter capability (#698)
* Add inventory filter capability.

* Use community.library_inventory_filtering_v1 collection.

* Bump dependency to 1.0.0.

* Mention the new dependency in the changelog.
2024-01-13 15:51:02 +01:00
Felix Fontein
97a0610f25
Docker Compose v2: extend/improve event parsing tests (#752)
* Normalize ansible-docker-test-xxx in stderr logs.

* Deduplicate.

* Add new testcases including the new module.
2024-01-13 15:49:30 +01:00
Felix Fontein
307dc4045a
Add docker_compose_v2_pull module (#751)
* Add docker_compose_v2_pull module.

* Improve and extend parsing of events.

* Add ignores.

* --policy is only available since Compose 2.22.0.
2024-01-13 14:36:26 +01:00
Felix Fontein
cb4dd2fed1
docker_compose_v2: move some code to module_utils (#747)
* Move some code to module_utils.

* Add unit tests.

Test cases are auto-generated from integration test logs.

* Rename ResourceEvent → Event.
2024-01-07 16:17:31 +01:00
Felix Fontein
eed89f32eb
docker_compose_v2: allow to specify pull policy; parse pull events; improve error handling; always return stderr (#746)
* Add pull option for 'docker compose up'.

* Improve dry-mode event parsing, and also parse pull-related events.

* Improve error handling, and add first tests.

* Fix action status documentation.

* Add more tests.

* Always return stderr.

This makes debugging misbehavior a lot easier since you can see
what 'docker compose' actually returned.

* Reformat existing tests.
2024-01-07 08:45:20 +01:00
Felix Fontein
5256f94342
Adjust to new shellcheck in ansible-core devel's sanity tests. (#741) 2024-01-04 22:27:34 +01:00
Felix Fontein
b774837183
Add docker_compose_v2 module (#739)
* Add docker_compose_v2 module.

* Add note on compatibility.

* Parse more events.

Emit warnings (or things we assume are warnings), and report unparsable
messages to the user so they can report them to us.
2024-01-03 07:05:08 +00:00
Felix Fontein
39717d380e
Avoid shadowing loop variables. (#738) 2024-01-02 14:21:19 +01:00
Felix Fontein
ce7402dc9f
Add docker_image_build module. (#735) 2024-01-02 09:21:45 +01:00
Felix Fontein
42453444ff
Compose digest instead of accidentally using wrong one. (#733) 2023-12-31 15:31:43 +01:00
Felix Fontein
c3f8f80a75
Add docker_image_remove module. (#732) 2023-12-31 15:13:04 +01:00
Felix Fontein
66b341aa9e
Add docker_image_tag module (#730)
* Add docker_image_tag module.

* Add check mode tests.

* Improve and test image ID/digest handling.

* Adjust more tests.
2023-12-31 10:41:18 +01:00
Felix Fontein
20e78a92e0
Add docker_image_pull module (#728)
* Add docker_image_pull module.

* Support platform during idempotency check.

* Add diff mode, extend tests.

* Add image ID tests.
2023-12-31 09:51:42 +01:00
Felix Fontein
e22cee2c41
Add docker_image_push module. (#731) 2023-12-31 08:33:32 +00:00
Felix Fontein
8ee0452776
Run registry tests only when registry is present. (#729) 2023-12-29 11:27:49 +01:00
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