Skip to content

Commit

Permalink
bump ansible to 2.17, raise ninimum python to 3.7 (#200)
Browse files Browse the repository at this point in the history
bump ansible+python to 2.17+3.7, update distros

with the ansible-2.17 release, python 2 and 3.6 have been removed
from the officially supported list. We therefore have to upgrade
our minimum tested version to 3.7, which is a breaking change
as it requires removing official support for RockyLinux 8.

Also use this opportunity to add support for Ubuntu 24.04.
  • Loading branch information
maxhoesel authored Jun 18, 2024
1 parent 53a4488 commit 4acfacf
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 76 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ workflows:
parallelism: 3
matrix:
parameters:
ansible-version: ["2.15", "2.16"]
node-python-version: ["3.6"]
ansible-version: ["2.16", "2.17"]
node-python-version: ["3.7"]
- collection-testing/pre-commit-lint:
name: Lint
- collection-testing/antsibull-docs:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ An Ansible collection containing roles/modules to install, configure and interac

- A recent release of Ansible. This collection officially supports the 2 most recent Ansible releases.
Older versions might still work, but are not supported
- Python 3.6 or newer on the target host
- Python 3.7 or newer on the target host
- The modules require the `requests` python module on the remote host

Individual roles or modules may have additional dependencies, please check their respective documentation.
Expand Down
4 changes: 2 additions & 2 deletions roles/caddy_server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ Alternatively, you can also configure caddy with a Caddyfile by passing it to th
## Requirements

- The following distributions are currently supported and tested:
- Ubuntu: 20.04 LTS, 22.04 LTS
- Ubuntu: 20.04 LTS, 22.04, 24.04 LTS
- Debian: 10, 11, 12
- RockyLinux: 8, 9
- RockyLinux: 9
- The following distributions are supported on a best-effort basis (should work but are not tested in CI):
- Arch Linux
- Supported architectures: Anything supported by upstream caddy should work
Expand Down
34 changes: 15 additions & 19 deletions roles/caddy_server/molecule/caddyfile/molecule.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
---
platforms:
# Note on containers:
# - We use the images provided by geerlingguy, as they provide out-of-the-box
# support for Ansible and systemd (needed to test service management).
- name: caddy-ubuntu-22
- name: caddy-ubuntu-24
groups:
- ubuntu
image: "docker.io/geerlingguy/docker-ubuntu2204-ansible"
image: "docker.io/geerlingguy/docker-ubuntu2404-ansible"
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
Expand All @@ -19,6 +16,19 @@ platforms:
capabilities:
- NET_ADMIN

- name: caddy-ubuntu-22
groups:
- ubuntu
image: "docker.io/geerlingguy/docker-ubuntu2204-ansible"
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
privileged: true
override_command: false
pre_build_image: true
capabilities:
- NET_ADMIN

- name: caddy-ubuntu-20
groups:
- ubuntu
Expand Down Expand Up @@ -84,19 +94,6 @@ platforms:
capabilities:
- NET_ADMIN

- name: caddy-rockylinux-8
groups:
- rockylinux
image: "docker.io/geerlingguy/docker-rockylinux8-ansible"
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
privileged: true
override_command: false
pre_build_image: true
capabilities:
- NET_ADMIN

# Only supported on a best effort-basis, CI is broken right now (2023-03-03)
# - name: caddy-archlinux
# groups:
Expand All @@ -111,7 +108,6 @@ platforms:
# capabilities:
# - NET_ADMIN


provisioner:
playbooks:
prepare: ../prepare.yml
Expand Down
33 changes: 15 additions & 18 deletions roles/caddy_server/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
---
platforms:
# Note on containers:
# - We use the images provided by geerlingguy, as they provide out-of-the-box
# support for Ansible and systemd (needed to test service management).
- name: caddy-ubuntu-22
- name: caddy-ubuntu-24
groups:
- ubuntu
image: "docker.io/geerlingguy/docker-ubuntu2204-ansible"
image: "docker.io/geerlingguy/docker-ubuntu2404-ansible"
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
Expand All @@ -19,6 +16,19 @@ platforms:
capabilities:
- NET_ADMIN

- name: caddy-ubuntu-22
groups:
- ubuntu
image: "docker.io/geerlingguy/docker-ubuntu2204-ansible"
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
privileged: true
override_command: false
pre_build_image: true
capabilities:
- NET_ADMIN

- name: caddy-ubuntu-20
groups:
- ubuntu
Expand Down Expand Up @@ -84,19 +94,6 @@ platforms:
capabilities:
- NET_ADMIN

- name: caddy-rockylinux-8
groups:
- rockylinux
image: "docker.io/geerlingguy/docker-rockylinux8-ansible"
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
privileged: true
override_command: false
pre_build_image: true
capabilities:
- NET_ADMIN

# Only supported on a best effort-basis, CI is broken right now (2023-03-03)
# - name: caddy-archlinux
# groups:
Expand Down
46 changes: 12 additions & 34 deletions tests/plugins/test_plugins.py
Original file line number Diff line number Diff line change
@@ -1,40 +1,18 @@
# pylint: disable=redefined-outer-name

from pathlib import Path

from jinja2 import Environment, FileSystemLoader

INTEGRATION_CONFIG_DIR = Path("tests/integration/")
INTEGRATION_CONFIG_TEMPLATE = "integration_config.yml.j2"
INTEGRATION_CONFIG_FILE = "integration_config.yml"


def render_integration_config(template, dest: Path, **kwargs):
env = Environment(loader=FileSystemLoader(INTEGRATION_CONFIG_DIR))
template = env.get_template(template)
content = template.render(**kwargs)
with open(dest, "w", encoding="utf-8") as f:
f.write(f"{content}\n")


def test_plugins_integration(test_versions, remote_caddy_container, collection_test_env):
render_integration_config(
INTEGRATION_CONFIG_TEMPLATE,
collection_test_env.cwd / "tests" / "integration" / INTEGRATION_CONFIG_FILE,
admin_url=remote_caddy_container.caddy_url,
)

collection_test_env.run([
"ansible-test", "integration", "--color", "-v",
"--controller", "docker:default",
"--target", f"docker:default,python={test_versions.node_python_version}",
"--docker-network", remote_caddy_container.ct_network,
])


def test_plugins_sanity(collection_test_env, test_versions):
collection_test_env.run([
params = [
"ansible-test",
"sanity", "--docker", "--color", "-v",
"--python", test_versions.node_python_version,
])
]

if int(test_versions.ansible_version.split(".")[1]) <= 16:
# these flags are only valid with ansible-test 2.16 and older, as they refer to python 2.7.
# Do not include them with newer versions of ansible-test
params.extend([
"--skip-test", "metaclass-boilerplate",
"--skip-test", "future-import-boilerplate"
])

collection_test_env.run(params)

0 comments on commit 4acfacf

Please sign in to comment.