From f077d42a30fb81986b04eee4f080b02df9216a7f Mon Sep 17 00:00:00 2001 From: Robert de Bock Date: Wed, 24 Jul 2024 11:15:15 +0200 Subject: [PATCH] Test maintained versions of ansible-core. --- .github/workflows/molecule.yml | 63 +++++++++++++++++++++++++++++----- .gitlab-ci.yml | 23 +++++++++---- README.md | 3 +- SECURITY.md | 3 +- meta/main.yml | 4 --- meta/preferences.yml | 9 +++-- molecule/default/molecule.yml | 2 +- requirements.txt | 8 ++--- tox.ini | 48 ++++++++++++++++++++++++++ 9 files changed, 132 insertions(+), 31 deletions(-) create mode 100644 tox.ini diff --git a/.github/workflows/molecule.yml b/.github/workflows/molecule.yml index b0b5315..b56bacd 100644 --- a/.github/workflows/molecule.yml +++ b/.github/workflows/molecule.yml @@ -21,18 +21,19 @@ jobs: uses: actions/checkout@v4 - name: ansible-lint uses: ansible-community/ansible-lint-action@main - test: + + python-3-9: needs: - lint runs-on: ubuntu-20.04 + container: + image: python:3.9 strategy: fail-fast: false matrix: config: - image: "alpine" tag: "latest" - - image: "enterpriselinux" - tag: "8" - image: "enterpriselinux" tag: "latest" - image: "debian" @@ -45,8 +46,50 @@ jobs: tag: "latest" - image: "fedora" tag: "rawhide" - - image: "opensuse" + - image: "ubuntu" + tag: "latest" + - image: "ubuntu" + tag: "jammy" + - image: "ubuntu" + tag: "focal" + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: molecule + run: | + apt-get update -qq + apt-get -y -qq install yamllint docker.io + pip install --no-cache-dir tox + if [ -f tox.ini ] ; then tox ; fi + if [ ! -f tox.ini ] ; then pip install -r requirements.yml ; pip install ansible-lint ansible-core ; molecule test ; fi + env: + image: ${{ matrix.config.image }} + tag: ${{ matrix.config.tag }} + python-3-10: + needs: + - lint + runs-on: ubuntu-20.04 + container: + image: python:3.10 + strategy: + fail-fast: false + matrix: + config: + - image: "alpine" + tag: "latest" + - image: "enterpriselinux" + tag: "latest" + - image: "debian" tag: "latest" + - image: "debian" + tag: "bullseye" + - image: "fedora" + tag: "39" + - image: "fedora" + tag: "latest" + - image: "fedora" + tag: "rawhide" - image: "ubuntu" tag: "latest" - image: "ubuntu" @@ -56,10 +99,14 @@ jobs: steps: - name: checkout uses: actions/checkout@v4 - with: - path: "${{ github.repository }}" + - name: molecule - uses: robertdebock/molecule-action@6.0.1 - with: + run: | + apt-get update -qq + apt-get -y -qq install yamllint docker.io + pip install --no-cache-dir tox + if [ -f tox.ini ] ; then tox ; fi + if [ ! -f tox.ini ] ; then pip install -r requirements.yml ; pip install ansible-lint ansible-core ; molecule test ; fi + env: image: ${{ matrix.config.image }} tag: ${{ matrix.config.tag }} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index be8ff3d..d3cd53b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,41 +1,50 @@ --- -image: "robertdebock/github-action-molecule:6.0.1" variables: - PY_COLORS: 1 + DEBIAN_FRONTEND: noninteractive molecule: + image: $python script: + - apt-get update -qq + - apt-get -y -qq install yamllint docker.io + - pip install --no-cache-dir tox - if [ -f tox.ini ] ; then tox ; fi - - if [ ! -f tox.ini ] ; then molecule test ; fi + - if [ ! -f tox.ini ] ; then pip install -r requirements.yml ; pip install ansible-lint ansible-core ; molecule test ; fi rules: - if: $CI_COMMIT_REF_NAME == "master" parallel: matrix: - image: "alpine" tag: "latest" - - image: "enterpriselinux" - tag: "8" + python: ['python:3.9', 'python:3.10'] - image: "enterpriselinux" tag: "latest" + python: ['python:3.9', 'python:3.10'] - image: "debian" tag: "latest" + python: ['python:3.9', 'python:3.10'] - image: "debian" tag: "bullseye" + python: ['python:3.9', 'python:3.10'] - image: "fedora" tag: "39" + python: ['python:3.9', 'python:3.10'] - image: "fedora" tag: "latest" + python: ['python:3.9', 'python:3.10'] - image: "fedora" tag: "rawhide" - - image: "opensuse" - tag: "latest" + python: ['python:3.9', 'python:3.10'] - image: "ubuntu" tag: "latest" + python: ['python:3.9', 'python:3.10'] - image: "ubuntu" tag: "jammy" + python: ['python:3.9', 'python:3.10'] - image: "ubuntu" tag: "focal" + python: ['python:3.9', 'python:3.10'] galaxy: script: diff --git a/README.md b/README.md index e94b9a8..b348a99 100644 --- a/README.md +++ b/README.md @@ -92,10 +92,9 @@ This role has been tested on these [container images](https://hub.docker.com/u/r |container|tags| |---------|----| |[Alpine](https://hub.docker.com/r/robertdebock/alpine)|all| -|[EL](https://hub.docker.com/r/robertdebock/enterpriselinux)|8, 9| +|[EL](https://hub.docker.com/r/robertdebock/enterpriselinux)|9| |[Debian](https://hub.docker.com/r/robertdebock/debian)|all| |[Fedora](https://hub.docker.com/r/robertdebock/fedora)|all| -|[opensuse](https://hub.docker.com/r/robertdebock/opensuse)|all| |[Ubuntu](https://hub.docker.com/r/robertdebock/ubuntu)|all| The minimum version of Ansible required is 2.12, tests have been done to: diff --git a/SECURITY.md b/SECURITY.md index e990627..bcaaa70 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -8,8 +8,9 @@ These version of [ansible](https://pypi.org/project/ansible/) are supported: | Version | Supported | | ------- | ------------------ | -| 5 | :white_check_mark: | +| 7 | :white_check_mark: | | 6 | :white_check_mark: | +| 5 | :white_check_mark: | ## [Reporting a Vulnerability](#reporting-a-vulnarability) diff --git a/meta/main.yml b/meta/main.yml index 96a3839..83a16b8 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -13,7 +13,6 @@ galaxy_info: - all - name: EL versions: - - "8" - "9" - name: Debian versions: @@ -21,9 +20,6 @@ galaxy_info: - name: Fedora versions: - all - - name: opensuse - versions: - - all - name: Ubuntu versions: - all diff --git a/meta/preferences.yml b/meta/preferences.yml index 5199959..45cf879 100644 --- a/meta/preferences.yml +++ b/meta/preferences.yml @@ -1,4 +1,7 @@ --- -tox_ansible_versions: - - 5 - - 6 + +matrix_overrides: + amazonlinux: + python: + - python:3.9 + - python:3.10 diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index b59a852..9878685 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -18,7 +18,7 @@ platforms: image: "${namespace:-robertdebock}/${image:-fedora}:${tag:-latest}" command: /sbin/init volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:ro + - /sys/fs/cgroup:/sys/fs/cgroup:rw privileged: true pre_build_image: true provisioner: diff --git a/requirements.txt b/requirements.txt index 65b52f4..e377941 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,3 @@ -ansible-compat == 4.* -molecule == 6.* -molecule-plugins[docker] == 23.* -ansible-lint == 6.* -paramiko == 3.* +molecule +molecule-plugins[docker] +paramiko diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..ed6d0aa --- /dev/null +++ b/tox.ini @@ -0,0 +1,48 @@ +[tox] +envlist = ansible-2.{15,16,17} +skipsdist = true + +[testenv] +commands = molecule test + +setenv = + TOX_ENVNAME={envname} + PY_COLORS=1 + ANSIBLE_FORCE_COLOR=1 + ANSIBLE_ROLES_PATH=../ + +passenv = namespace, image, tag, DOCKER_HOST + +# Test supported releases of ansible-core. See: +# https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html#ansible-core-support-matrix + +[testenv:ansible-2.15] +basepython = python3.9 +deps = + -rrequirements.txt + ansible-core==2.15.* + ansible-lint==6.* + +[testenv:ansible-2.16] +basepython = python3.10 +deps = + -rrequirements.txt + ansible-core==2.16.* + ansible-lint==24.* + +[testenv:ansible-2.17] +basepython = python3.10 +deps = + -rrequirements.txt + ansible-core==2.17.* + ansible-lint==24.* + +# Future work, not releases, just prepared. See: +# https://docs.ansible.com/ansible/devel//roadmap/ROADMAP_2_18.html +# Note: enable python3.13 in `vars/main.yml` as well. +# [testenv:ansible-2.18] +# basepython = python3.13 +# deps = +# -rrequirements.txt +# ansible-core==2.18.* +# ansible-lint==24.*