From 66bab3efda0fada6252ea52b11c2bc9ccdcbe14d Mon Sep 17 00:00:00 2001 From: Robert de Bock Date: Sat, 20 Jul 2024 08:10:10 +0200 Subject: [PATCH] Tox reintroduced. --- files/requirements.txt | 8 ++--- generate.yml | 26 ++++++++-------- templates/tox.ini.j2 | 69 +++++++++++++++++++++++++++--------------- 3 files changed, 60 insertions(+), 43 deletions(-) diff --git a/files/requirements.txt b/files/requirements.txt index 4d7adb3..e377941 100644 --- a/files/requirements.txt +++ b/files/requirements.txt @@ -1,5 +1,3 @@ -ansible-compat == 24.* -molecule == 24.* -molecule-plugins[docker] == 23.* -ansible-lint == 24.* -paramiko == 3.* +molecule +molecule-plugins[docker] +paramiko diff --git a/generate.yml b/generate.yml index 0aaae48..3b16bff 100755 --- a/generate.yml +++ b/generate.yml @@ -141,21 +141,19 @@ mode: "0644" when: - generate_ansible_lint - # Since May 2024, tox stopped working, throwing this error: - # CRITICAL Unable to contact the Docker daemon. Please refer to https://docs.docker.com/config/daemon/ for managing the daemon - # It's disabled for now. - # - name: Render file tox.ini - # ansible.builtin.template: - # src: "{{ playbook_dir }}/templates/tox.ini.j2" - # dest: "{{ role_path }}/tox.ini" - # mode: "0644" - # when: - # - generate_tox - - name: Remove tox.ini - ansible.builtin.file: - path: "{{ role_path }}/tox.ini" - state: absent + - name: Render file tox.ini + ansible.builtin.template: + src: "{{ playbook_dir }}/templates/tox.ini.j2" + dest: "{{ role_path }}/tox.ini" + mode: "0644" + when: + - generate_tox + + # - name: Remove tox.ini + # ansible.builtin.file: + # path: "{{ role_path }}/tox.ini" + # state: absent - name: Render file .github/settings.yml ansible.builtin.template: diff --git a/templates/tox.ini.j2 b/templates/tox.ini.j2 index 21da77e..e698e87 100644 --- a/templates/tox.ini.j2 +++ b/templates/tox.ini.j2 @@ -1,35 +1,56 @@ -{{ ansible_managed | comment }} [tox] -minversion = 4.2.4 -{% if tox_ansible_versions is defined %} -envlist = py3-ansible{% raw %}{{% endraw %}{% for version in tox_ansible_versions %}{{ version }}{% if not loop.last %},{% endif %}{% endfor %}{% raw %}}{% endraw %} -{% else %} -envlist = py3-ansible{8,9,10} -{% endif %} - +envlist = ansible-2.{12,13,14,15,16,17} skipsdist = true [testenv] -deps = - -rrequirements.txt - ansible8: ansible == 8.* - ansible9: ansible == 9.* - ansible10: ansible == 10.* - commands = molecule test + setenv = TOX_ENVNAME={envname} PY_COLORS=1 ANSIBLE_FORCE_COLOR=1 ANSIBLE_ROLES_PATH=../ -passenv = - namespace - image - tag - DOCKER_HOST -{% if github_variables_mapping is defined %} -{% for item in github_variables_mapping %} - {{ item.variable }} -{% endfor %} -{% endif %} +passenv = namespace, image, tag, DOCKER_HOST + +[testenv:ansible-2.12] +basepython = python3.8 +deps = + -rrequirements.txt + ansible-core==2.12.* + ansible-lint==5.* + +[testenv:ansible-2.13] +basepython = python3.8 +deps = + -rrequirements.txt + ansible-core==2.13.* + ansible-lint==5.* + +[testenv:ansible-2.14] +basepython = python3.9 +deps = + -rrequirements.txt + ansible-core==2.14.* + ansible-lint==6.* + +[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.*