Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ansible-test - Improve container management. #78550

Merged
merged 84 commits into from Nov 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
c9c39c7
ansible-test - Improve docker and podman support.
mattclay Aug 16, 2022
884e2ae
ansible-test - Add container testing to CI.
mattclay Sep 22, 2022
bf8082e
Temporarily remove other parts of the CI matrix.
mattclay Sep 22, 2022
7fe7454
Fix chown instructions.
mattclay Sep 23, 2022
694beb3
Warn when images contain volumes.
mattclay Sep 23, 2022
bee0af8
Fix cgroup check in explain mode.
mattclay Sep 23, 2022
56c1be1
Remove use of `-i` option to run containers.
mattclay Sep 23, 2022
4854e30
Fix target failure handling.
mattclay Sep 27, 2022
81e56fb
Fix error handling conditional.
mattclay Sep 27, 2022
e4893ee
Fix podman network selection.
mattclay Sep 27, 2022
fbff3df
Make inspect commands more robust.
mattclay Sep 27, 2022
aae8dfb
Limit on_failure to connection failures.
mattclay Sep 27, 2022
0c5cb5a
Update --tmpfs comments.
mattclay Sep 27, 2022
f7a90e3
Add changelog fragment.
mattclay Sep 27, 2022
2569339
Include multi-container testing and test default.
mattclay Sep 28, 2022
c7646b1
Support systems without audit enabled.
mattclay Sep 28, 2022
92e8aa0
Remove pointless f-string.
mattclay Sep 28, 2022
f4a1a45
Use host max open file limit if lower than pref.
mattclay Sep 28, 2022
aedc336
Disable podman systemd for containers w/o systemd.
mattclay Sep 28, 2022
f1d1b48
Make rmtree in testing more robust.
mattclay Sep 28, 2022
7284a9a
Prevent concurrent pulls of the same image.
mattclay Sep 29, 2022
01b7913
Prevent concurrent execution of cached methods.
mattclay Sep 29, 2022
c11dd06
Include container name in log message.
mattclay Sep 29, 2022
2db5751
Don't ignore remount errors.
mattclay Sep 29, 2022
683750b
Remove keep_image from test.
mattclay Oct 3, 2022
f604215
Remove cgroup debug output.
mattclay Oct 3, 2022
5471790
Use alpine3 for controller container.
mattclay Oct 3, 2022
a513913
Kill podman processes between tests.
mattclay Oct 3, 2022
3939511
Improve cgroup v1 detection and messaging.
mattclay Oct 5, 2022
bd44ef6
Improve test script.
mattclay Oct 5, 2022
e4e0e35
Remove cgroup v1 display.
mattclay Oct 5, 2022
c9217a9
Avoid duplicate volume under podman.
mattclay Oct 6, 2022
90bc91f
Overhaul container management and testing.
mattclay Nov 1, 2022
1c9d0c7
Remove out-of-date changelog entry.
mattclay Nov 1, 2022
85ca8aa
Put systemd debug behind a dev option.
mattclay Nov 1, 2022
60e35ac
Adjust retries. Update changelog.
mattclay Nov 1, 2022
a70b81b
Fix container probe without loginuid.
mattclay Nov 1, 2022
37ca0c5
Pass through XDG_RUNTIME_DIR to podman.
mattclay Nov 2, 2022
494a27d
Remove out-of-date changelog entry.
mattclay Nov 2, 2022
b394c85
Remove unused code.
mattclay Nov 2, 2022
3934222
Simplify the Podman instructions.
mattclay Nov 2, 2022
b3d6598
Update documentation.
mattclay Nov 2, 2022
fcfcfeb
Detect Docker Desktop with WSL2 and add docs ref.
mattclay Nov 2, 2022
4c8166b
Add WSL2 changelog entries.
mattclay Nov 2, 2022
4c571e0
Add missing requirements docs.
mattclay Nov 3, 2022
23a7eaf
Use Python 3.10 as an example.
mattclay Nov 3, 2022
ada90ff
Improve readability of completion __repr__.
mattclay Nov 3, 2022
b309a7e
Fix pkill logic.
mattclay Nov 9, 2022
c219869
Add more docker/podman version info and checks.
mattclay Nov 11, 2022
8e7386b
Improve env error handling. Adjust error format.
mattclay Nov 11, 2022
541e312
Add cgroup version probing.
mattclay Nov 11, 2022
0cf09c7
Update docs to follow style guide.
mattclay Nov 11, 2022
d3f4de1
Fix up out-of-date docs.
mattclay Nov 11, 2022
cbc5f7d
Documentation improvements.
mattclay Nov 11, 2022
05f8d73
Refactor container management.
mattclay Nov 14, 2022
bd08835
Improve cgroup error handling.
mattclay Nov 14, 2022
79e95f3
Make cgroup v1 management more robust.
mattclay Nov 14, 2022
ad4e806
Add work-around for Podman 4.3.0 regression.
mattclay Nov 15, 2022
fa9d858
Fix initial connection logic for remote instances.
mattclay Nov 15, 2022
8767284
Add work-around for broken podman on RHEL 9.
mattclay Nov 16, 2022
4104a1b
Add work-around for broken netavark in Fedora 36.
mattclay Nov 16, 2022
c20aade
Fix docker start logic.
mattclay Nov 16, 2022
a0fc606
Add reference for netavark bug.
mattclay Nov 17, 2022
be874ff
Document docker providing AUDIT_WRITE.
mattclay Nov 17, 2022
60e539a
Update AUDIT_WRITE handling.
mattclay Nov 17, 2022
c99f180
Remove unused tests.
mattclay Nov 17, 2022
4f77aa3
Improve handling of SSH connection errors.
mattclay Nov 18, 2022
e0ccd14
Add support for the `retry/never` alias.
mattclay Nov 18, 2022
db7a585
Skip testing of the default container.
mattclay Nov 18, 2022
8c46500
Revert "Temporarily remove other parts of the CI matrix."
mattclay Nov 18, 2022
f752219
Changelog corrections.
mattclay Nov 18, 2022
999ef96
Relocate CLI code for `--dev-` prefixed options.
mattclay Nov 18, 2022
6430d80
Add docs for custom containers.
mattclay Nov 21, 2022
5c19feb
Document more known issues.
mattclay Nov 21, 2022
b910685
Improve container pull/inspect error handling.
mattclay Nov 22, 2022
7d91eb1
Use "container" instead of "docker" in pull messages.
mattclay Nov 22, 2022
100d966
Add SSH retries to the test suite.
mattclay Nov 22, 2022
22df959
Fix list numbering while making nearby changes.
mattclay Nov 22, 2022
9a62be0
Update docs based on review feedback.
mattclay Nov 22, 2022
7ec6076
Fix code-block language.
mattclay Nov 28, 2022
d25de4f
Make better use of pathlib in integration test.
mattclay Nov 28, 2022
83307d4
Maintain consistency of type hints.
mattclay Nov 28, 2022
34eeebb
Code cleanup.
mattclay Nov 28, 2022
a43812a
Fix audit probe errno handling.
mattclay Nov 29, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 19 additions & 2 deletions .azure-pipelines/azure-pipelines.yml
Expand Up @@ -84,7 +84,7 @@ stages:
- stage: Remote
dependsOn: []
jobs:
- template: templates/matrix.yml
- template: templates/matrix.yml # context/target
parameters:
targets:
- name: macOS 12.0
Expand All @@ -104,7 +104,7 @@ stages:
groups:
- 1
- 2
- template: templates/matrix.yml
- template: templates/matrix.yml # context/controller
parameters:
targets:
- name: macOS 12.0
Expand All @@ -119,6 +119,23 @@ stages:
- 3
- 4
- 5
- template: templates/matrix.yml # context/controller (ansible-test container management)
parameters:
targets:
- name: Alpine 3.16
test: alpine/3.16
- name: Fedora 36
test: fedora/36
- name: RHEL 8.6
test: rhel/8.6
- name: RHEL 9.0
test: rhel/9.0
- name: Ubuntu 20.04
test: ubuntu/20.04
- name: Ubuntu 22.04
test: ubuntu/22.04
groups:
- 6
- stage: Docker
dependsOn: []
jobs:
Expand Down
59 changes: 59 additions & 0 deletions changelogs/fragments/ansible-test-container-management.yml
@@ -0,0 +1,59 @@
major_changes:
- ansible-test - Docker and Podman are now supported on hosts with cgroup v2 unified.
Previously only cgroup v1 and cgroup v2 hybrid were supported.
- ansible-test - Docker Desktop on WSL2 is now supported (additional configuration required).
- ansible-test - Podman on WSL2 is now supported.
- ansible-test - Podman now works on container hosts without systemd.
Previously only some containers worked, while others required rootfull or rootless Podman,
but would not work with both. Some containers did not work at all.
- ansible-test - When additional cgroup setup is required on the container host, this will be automatically detected.
Instructions on how to configure the host will be provided in the error message shown.
minor_changes:
- ansible-test - When using Podman, ansible-test will detect if the loginuid used in containers is incorrect.
When this occurs a warning is displayed and the container is run with the AUDIT_CONTROL capability.
Previously containers would fail under this situation, with no useful warnings or errors given.
- ansible-test - Failure to connect to a container over SSH now results in a clear error.
Previously tests would be attempted even after initial connection attempts failed.
- ansible-test - Warnings are now shown when using containers that were built with VOLUME instructions.
- ansible-test - Unit tests now support network disconnect by default when running under Podman.
Previously this feature only worked by default under Docker.
- ansible-test - Additional log details are shown when containers fail to start or SSH connections to containers fail.
- ansible-test - Containers included with ansible-test no longer disable seccomp by default.
- ansible-test - A new ``cgroup`` option is available when running custom containers.
This option can be used to indicate a container requires cgroup v1 or that it does not use cgroup.
The default behavior assumes the container works with cgroup v2 (as well as v1).
- ansible-test - A new ``audit`` option is available when running custom containers.
This option can be used to indicate whether a container requires the AUDIT_WRITE capability.
The default is ``required``, which most containers will need when using Podman.
If necessary, the ``none`` option can be used to opt-out of the capability.
This has no effect on Docker, which always provides the capability.
- ansible-test - More details are provided about an instance when provisioning fails.
- ansible-test - Connection failures to remote provisioned hosts now show failure details as a warning.
- ansible-test - When setting the max open files for containers, the container host's limit will be checked.
If the host limit is lower than the preferred value, it will be used and a warning will be shown.
- ansible-test - Use ``stop --time 0`` followed by ``rm`` to remove ephemeral containers instead of ``rm -f``.
This speeds up teardown of ephemeral containers.
- ansible-test - Reduce the polling limit for SSHD startup in containers from 60 retries to 10.
The one second delay between retries remains in place.
- ansible-test - Integration tests can be excluded from retries triggered by the ``--retry-on-error`` option by
adding the ``retry/never`` alias. This is useful for tests that cannot pass on a retry or are too
slow to make retries useful.
bugfixes:
- ansible-test - Multiple containers now work under Podman without specifying the ``--docker-network`` option.
- ansible-test - Prevent concurrent / repeat pulls of the same container image.
- ansible-test - Prevent concurrent / repeat inspections of the same container image.
- ansible-test - Prevent concurrent execution of cached methods.
- ansible-test - Handle server errors when executing the ``docker info`` command.
- ansible-test - Show the exception type when reporting errors during instance provisioning.
- ansible-test - Pass the ``XDG_RUNTIME_DIR`` environment variable through to container commands.
- ansible-test - Connection attempts to managed remote instances no longer abort on ``Permission denied`` errors.
known_issues:
- ansible-test - Using Docker on systems with SELinux may require setting SELinux to permissive mode.
Podman should work with SELinux in enforcing mode.
- ansible-test - Additional configuration may be required for certain container host and container combinations.
Further details are available in the testing documentation.
- ansible-test - Systems with Podman networking issues may be unable to run containers, when previously the issue
went unreported. Correct the networking issues to continue using ``ansible-test`` with Podman.
- ansible-test - Custom containers with ``VOLUME`` instructions may be unable to start, when previously the containers
started correctly. Remove the ``VOLUME`` instructions to resolve the issue. Containers with this
condition will cause ``ansible-test`` to emit a warning.
10 changes: 4 additions & 6 deletions docs/docsite/rst/community/create_pr_quick_start.rst
Expand Up @@ -16,7 +16,7 @@ Prepare your environment
These steps assume a Linux work environment with ``git`` installed.


1. Install and start ``docker`` or ``podman`` with the ``docker`` executable shim. This insures tests run properly isolated and in the exact environments as in CI. The latest ``ansible-core`` development version also supports the ``podman`` CLI program.
1. Install and start ``docker`` or ``podman``. This ensures tests run properly isolated and in the same environment as in CI.

2. :ref:`Install Ansible or ansible-core <installation_guide>`. You need the ``ansible-test`` utility which is provided by either of these packages.

Expand Down Expand Up @@ -155,11 +155,9 @@ See :ref:`module_contribution` for some general guidelines about Ansible module
Test your changes
=================

If using the ``docker`` CLI program, the host must be configured to use cgroupsv1 (this is not required for ``podman``). This can be done by adding ``systemd.unified_cgroup_hierarchy=0`` to the kernel boot arguments (requires bootloader config update and reboot).

1. Install ``flake8`` (``pip install flake8``, or install the corresponding package on your operating system).

1. Run ``flake8`` against a changed file:
2. Run ``flake8`` against a changed file:

.. code-block:: bash

Expand All @@ -169,7 +167,7 @@ Test your changes
This shows unused imports, which are not shown by sanity tests, as well as other common issues.
Optionally, you can use the ``--max-line-length=160`` command-line argument.

2. Run sanity tests:
3. Run sanity tests:

.. code-block:: bash

Expand All @@ -178,7 +176,7 @@ Test your changes
If they failed, look at the output carefully - it is informative and helps to identify a problem line quickly.
Sanity failings usually relate to incorrect code and documentation formatting.

3. Run integration tests:
4. Run integration tests:

.. code-block:: bash

Expand Down
Expand Up @@ -96,6 +96,7 @@ There are several other aliases available as well:

- ``destructive`` - Requires ``--allow-destructive`` to run without ``--docker`` or ``--remote``.
- ``hidden`` - Target is ignored. Usable as a dependency. Automatic for ``setup_`` and ``prepare_`` prefixed targets.
- ``retry/never`` - Target is excluded from retries enabled by the ``--retry-on-error`` option.

Unstable
--------
Expand Down