From 2e7952890c8dcf81fd4d7f6932a6b5dd3cf8fe39 Mon Sep 17 00:00:00 2001 From: Jonas Pammer Date: Sun, 11 Feb 2024 00:11:57 +0100 Subject: [PATCH 1/4] refactor: drop support for ansible-core 2.11 and 2.12 Proof of Concept / copied from here: https://github.com/JonasPammer/ansible-role-bootstrap/pull/110/commits --- .../.devcontainer/devcontainer.json | 2 +- .../.github/workflows/ci.yml | 16 +++++++--------- .../DEVELOPMENT.adoc | 11 ++++------- .../README.orig.adoc | 3 +-- {{ cookiecutter.project_slug }}/tox.ini | 19 +++++++------------ 5 files changed, 20 insertions(+), 31 deletions(-) diff --git a/{{ cookiecutter.project_slug }}/.devcontainer/devcontainer.json b/{{ cookiecutter.project_slug }}/.devcontainer/devcontainer.json index 518264d..06b21ab 100644 --- a/{{ cookiecutter.project_slug }}/.devcontainer/devcontainer.json +++ b/{{ cookiecutter.project_slug }}/.devcontainer/devcontainer.json @@ -15,7 +15,7 @@ "ghcr.io/devcontainers/features/git-lfs:1": {}, "ghcr.io/devcontainers/features/github-cli:1": {}, "ghcr.io/devcontainers/features/python:1": { - "version": "3.9" + "version": "3.12" } }, // Use 'forwardPorts' to make a list of ports inside the container available locally. diff --git a/{{ cookiecutter.project_slug }}/.github/workflows/ci.yml b/{{ cookiecutter.project_slug }}/.github/workflows/ci.yml index 12616b7..3baf97f 100644 --- a/{{ cookiecutter.project_slug }}/.github/workflows/ci.yml +++ b/{{ cookiecutter.project_slug }}/.github/workflows/ci.yml @@ -31,16 +31,16 @@ name: CI (Lint + Molecule) description: "Select Ansible Versions to run" required: false type: choice + # (minimum) default: "ansible-6" options: - - ansible-4,ansible-5,ansible-6,ansible-7,ansible-8 - - ansible-4,ansible-5,ansible-6 - - ansible-7,ansible-8 - - ansible-4 - - ansible-5 + - ansible-6,ansible-7,ansible-8,ansible-9 + - ansible-7,ansible-8,ansible-9 + - ansible-8,ansible-9 - ansible-6 - ansible-7 - ansible-8 + - ansible-9 pull_request: branches-ignore: - renovate/** @@ -80,7 +80,7 @@ jobs: - name: set up python 3 uses: actions/setup-python@v4 with: - python-version: "3.9" + python-version: "3.10" - name: Install yamllint package. run: pip3 install "yamllint==1.*" @@ -145,7 +145,7 @@ jobs: - name: set up python 3 uses: actions/setup-python@v4 with: - python-version: "3.9" + python-version: "3.10" - name: setup/activate pre-commit cache uses: actions/cache@v3 @@ -160,7 +160,6 @@ jobs: run: tox env: TOX_SKIP_ENV: pre-commit - TOX_PARALLEL_NO_SPINNER: 1 MOLECULE_DISTRO: {% raw %}${{ matrix.distro }}{% endraw %} if: github.event_name != 'workflow_dispatch' @@ -169,7 +168,6 @@ jobs: env: TOXENV: py3-{% raw %}${{ github.event.inputs.ansible_version }}{% endraw %} TOX_SKIP_ENV: pre-commit - TOX_PARALLEL_NO_SPINNER: 1 MOLECULE_DISTRO: {% raw %}${{ matrix.distro }}{% endraw %} MOLECULE_DESTROY: never if: env.WORKFLOW_DISPATCH_IF == 'true' diff --git a/{{ cookiecutter.project_slug }}/DEVELOPMENT.adoc b/{{ cookiecutter.project_slug }}/DEVELOPMENT.adoc index f41d1ef..e64d849 100644 --- a/{{ cookiecutter.project_slug }}/DEVELOPMENT.adoc +++ b/{{ cookiecutter.project_slug }}/DEVELOPMENT.adoc @@ -1,7 +1,7 @@ [[development-system-dependencies]] === 📌 Development Machine Dependencies -* Python 3.9 or greater +* Python 3.10 or greater * Docker [[development-dependencies]] @@ -74,11 +74,11 @@ take a look at the matrix defined in link:.github/workflows/ci.yml[]. $ *MOLECULE_DESTROY=never MOLECULE_DISTRO=#ubuntu1604# tox -e py3-ansible-#5#* ... TASK [ansible-role-pip : (redacted).] pass:[************************] - failed: [instance-py3-ansible-5] => changed=false + failed: [instance-py3-ansible-9] => changed=false ... pass:[___________________________________ summary ____________________________________] pre-commit: commands succeeded -ERROR: py3-ansible-5: commands failed +ERROR: py3-ansible-9: commands failed ---- 2. Find out the name of the molecule-provisioned docker container: @@ -86,7 +86,7 @@ ERROR: py3-ansible-5: commands failed [subs="quotes"] ---- $ *docker ps* -#30e9b8d59cdf# geerlingguy/docker-debian10-ansible:latest "/lib/systemd/systemd" 8 minutes ago Up 8 minutes instance-py3-ansible-5 +#30e9b8d59cdf# geerlingguy/docker-debian10-ansible:latest "/lib/systemd/systemd" 8 minutes ago Up 8 minutes instance-py3-ansible-9 ---- 3. Get into a bash Shell of the container, and do your debugging: @@ -96,9 +96,6 @@ $ *docker ps* $ *docker exec -it #30e9b8d59cdf# /bin/bash* root@instance-py3-ansible-2:/# -root@instance-py3-ansible-2:/# python3 --version -Python 3.8.10 -root@instance-py3-ansible-2:/# ... ---- + [TIP] diff --git a/{{ cookiecutter.project_slug }}/README.orig.adoc b/{{ cookiecutter.project_slug }}/README.orig.adoc index 25efa15..8d00418 100644 --- a/{{ cookiecutter.project_slug }}/README.orig.adoc +++ b/{{ cookiecutter.project_slug }}/README.orig.adoc @@ -252,11 +252,10 @@ https://github.com/ansible-collections/community.general#tested-with-ansible[ support pattern of Ansible's `community.general` collection]. As of writing this is: -* 2.11 (Ansible 4) -* 2.12 (Ansible 5) * 2.13 (Ansible 6) * 2.14 (Ansible 7) * 2.15 (Ansible 8) +* 2.16 (Ansible 9) [[development]] diff --git a/{{ cookiecutter.project_slug }}/tox.ini b/{{ cookiecutter.project_slug }}/tox.ini index 0b19dc5..6c26ad4 100644 --- a/{{ cookiecutter.project_slug }}/tox.ini +++ b/{{ cookiecutter.project_slug }}/tox.ini @@ -7,28 +7,23 @@ extend-ignore = E203 ### Ansible Testing through Molecule ### [tox] minversion = 4.1.2 -envlist = pre-commit,py{3}-ansible-{4,5,6,7,8} +envlist = pre-commit,py{3}-ansible-{6,7,8,9} skipsdist = true [testenv] passenv = * -parallel_show_output = True deps = - # For information on what included in the the "ansible" package, - # see https://github.com/ansible-community/ansible-build-data/blob/main/ (e.g. `/5/ansible-5.build`). - ansible-4: ansible == 4.* # core 2.11 - ansible-5: ansible == 5.* # core 2.12 + # For information on what included in the the "ansible" package, see + # https://github.com/ansible-community/ansible-build-data/blob/main/ (e.g. `/9/ansible-9.build`). ansible-6: ansible == 6.* # core 2.13 ansible-7: ansible == 7.* # core 2.14 ansible-8: ansible == 8.* # core 2.15 - ansible-4: molecule == 4.* - ansible-!4: molecule >= 5 # molecule v5.0.0 requires ansible-core>=2.12 - ansible-4: molecule-plugins[docker] == 22.* - ansible-!4: molecule-plugins[docker] >= 23 # molecule-plugins v23.4.0 requires ansible-core>=2.12 + ansible-9: ansible == 9.* # core 2.16 + molecule == 6.* + molecule-plugins[docker] == 23.* + ansible-lint == 6.* paramiko == 3.* - ansible-4: ansible-lint == 5.* - ansible-!4: ansible-lint >= 6 # ansible-lint 6 made ansible 2.12+ a direct dependency commands = ansible --version molecule destroy From d06dfacea1414db73de8b73d753cd2b715570304 Mon Sep 17 00:00:00 2001 From: Jonas Pammer Date: Sun, 11 Feb 2024 00:12:40 +0100 Subject: [PATCH 2/4] chore: sync default min_ansible_version --- .github/cookiecutter-example.yml | 2 +- cookiecutter.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/cookiecutter-example.yml b/.github/cookiecutter-example.yml index 86f8d00..1cb7c6b 100644 --- a/.github/cookiecutter-example.yml +++ b/.github/cookiecutter-example.yml @@ -5,7 +5,7 @@ default_context: github_username: "JonasPammer" galaxy_name: "jonaspammer" - min_ansible_version: "2.11" + min_ansible_version: "2.13" allow_duplicates: "no" ansible_user_needs_to_become: true diff --git a/cookiecutter.json b/cookiecutter.json index 2042192..0c47186 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -16,7 +16,7 @@ ], "galaxy_name": "jonaspammer", - "min_ansible_version": "2.11", + "min_ansible_version": "2.13", "allow_duplicates": "no", "ansible_user_needs_to_become": true, "use_renovate": false, From 4e5beeef46e5d996e821f7f20d81b43a9fca1e43 Mon Sep 17 00:00:00 2001 From: Jonas Pammer Date: Sun, 11 Feb 2024 00:16:32 +0100 Subject: [PATCH 3/4] chore: revert tox fix to make seperate pr --- {{ cookiecutter.project_slug }}/.github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/{{ cookiecutter.project_slug }}/.github/workflows/ci.yml b/{{ cookiecutter.project_slug }}/.github/workflows/ci.yml index 3baf97f..7eb8660 100644 --- a/{{ cookiecutter.project_slug }}/.github/workflows/ci.yml +++ b/{{ cookiecutter.project_slug }}/.github/workflows/ci.yml @@ -160,6 +160,7 @@ jobs: run: tox env: TOX_SKIP_ENV: pre-commit + TOX_PARALLEL_NO_SPINNER: 1 MOLECULE_DISTRO: {% raw %}${{ matrix.distro }}{% endraw %} if: github.event_name != 'workflow_dispatch' @@ -168,6 +169,7 @@ jobs: env: TOXENV: py3-{% raw %}${{ github.event.inputs.ansible_version }}{% endraw %} TOX_SKIP_ENV: pre-commit + TOX_PARALLEL_NO_SPINNER: 1 MOLECULE_DISTRO: {% raw %}${{ matrix.distro }}{% endraw %} MOLECULE_DESTROY: never if: env.WORKFLOW_DISPATCH_IF == 'true' From 0c89fb4f464e7c7051d1ba93de1cb9b21bacc4fb Mon Sep 17 00:00:00 2001 From: Jonas Pammer Date: Sun, 11 Feb 2024 00:34:46 +0100 Subject: [PATCH 4/4] fix(ci): set python to minimum required by project 3.12 resulted in the following error for ansible-6,ansible-7: ``` [1;35merror when attempting to call Galaxy at 'https://galaxy.ansible.com/api/':[0m [1;35mHTTPSConnection.__init__() got an unexpected keyword argument 'cert_file'.[0m [1;35mHTTPSConnection.__init__() got an unexpected keyword argument 'cert_file'[0m [0;31mERROR! - you can use --ignore-errors to skip failed roles and finish processing the list.[0m ``` cause: ansible pull 80751, which was only backported to direct previous (ansible-8) --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bde8cdf..307a85a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: - name: set up python 3 uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4 with: - python-version: "3.x" + python-version: "3.10" - name: setup/activate pre-commit cache uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3