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

Support for ansible-core 2.15 #151

Merged
merged 9 commits into from
Oct 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ concurrency:

jobs:
pytest:
name: Tests Py${{ matrix.python-version }} - Ansible ${{ matrix.ansible-version }}
name: Tests Py${{ matrix.python-version }} - Ansible ${{ matrix.ansible-core-version }}
env:
SVG_FILES_PATH: tests/generated-svgs
MERMAID_FILES_PATH: tests/generated-mermaids
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ '3.9', '3.10' ]
python-version: [ '3.10', '3.11' ]
# See https://www.ansible.com/blog/ansible-3.0.0-qa and https://docs.ansible.com/ansible/devel/reference_appendices/release_and_maintenance.html
ansible-version: [ '2.13.*', '2.14.*' ]
ansible-core-version: [ '2.15.*' ]


steps:
Expand All @@ -40,7 +40,7 @@ jobs:

- name: Install prereqs
run: |
pip install -q ansible-core=='${{ matrix.ansible-version }}' virtualenv setuptools wheel coveralls
pip install -q ansible-core=='${{ matrix.ansible-core-version }}' virtualenv setuptools wheel coveralls
pip install -qr tests/requirements_tests.txt
pip freeze
sudo apt-get install -yq graphviz
Expand All @@ -54,7 +54,7 @@ jobs:

- name: Set variables
run: |
matrix_ansible_version='${{ matrix.ansible-version }}'
matrix_ansible_version='${{ matrix.ansible-core-version }}'
clean_version=${matrix_ansible_version//.\*/} # Remove '.*' from the version name
echo "MATRIX_JOB_IDENTIFIER=py${{ matrix.python-version }}-ansible-${clean_version}" >> $GITHUB_ENV

Expand All @@ -80,13 +80,13 @@ jobs:
run: python tests/generate-job-summary.py >> $GITHUB_STEP_SUMMARY

- name: Test installation in virtualenv
run: make test_install ANSIBLE_VERSION=${{ matrix.ansible-version }}
run: make test_install ANSIBLE_CORE_VERSION=${{ matrix.ansible-core-version }}

- name: Upload Coverage
run: cd tests && coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: py${{ matrix.python-version }}-ansible${{ matrix.ansible-version }}
COVERALLS_FLAG_NAME: py${{ matrix.python-version }}-ansible${{ matrix.ansible-core-version }}
COVERALLS_PARALLEL: true

coveralls:
Expand Down
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
ANSIBLE_VERSION=2.10.7
VIRTUALENV_DIR=venv-test-install
PACKAGE := dist/$(shell ls dist 2> /dev/null)
SRC=$(wildcard ansibleplaybookgrapher/*.py setup.py ansibleplaybookgrapher/data/*)
Expand All @@ -20,7 +19,7 @@ deploy_test: clean build
@twine upload --repository-url https://test.pypi.org/legacy/ dist/*

test_install: build
@./tests/test_install.sh $(VIRTUALENV_DIR) $(ANSIBLE_VERSION)
@./tests/test_install.sh $(VIRTUALENV_DIR) $(ANSIBLE_CORE_VERSION)

test:
cd tests && pytest test_cli.py test_utils.py test_parser.py test_graph_model.py test_graphviz_postprocessor.py test_graphviz_renderer.py test_mermaid_renderer.py
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ JavaScript:

## Prerequisites

- Python 3.8 at least
- Python 3.10 at least. Might work with some previous versions but the code is tested against them.
See [support matrix](https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html#ansible-core-support-matrix).
- A virtual environment from which to run the grapher. This is **highly recommended** because the grapher depends on
some versions of ansible-core which are not necessarily installed in your environment and may cause issues if you use
some older versions of Ansible (
Expand Down Expand Up @@ -436,4 +437,3 @@ The project uses black to format the code. Run `black .` to format.
GNU General Public License v3.0 or later (Same as Ansible)

See [LICENSE](./LICENSE) for the full text

2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ansible-core>=2.12,<2.15
ansible-core>=2.15,<2.16
graphviz>=0.18,<1
colour<1
lxml<5
Expand Down
4 changes: 4 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os

import pytest
from ansible.plugins.loader import init_plugin_loader

from ansibleplaybookgrapher import __prog__
from ansibleplaybookgrapher.cli import PlaybookGrapherCLI
Expand Down Expand Up @@ -68,4 +69,7 @@ def grapher_cli(request) -> PlaybookGrapherCLI:
args_params[-1] = os.path.join(FIXTURES_DIR, args_params[-1])
cli = PlaybookGrapherCLI([__prog__] + args_params)
cli.parse()
# This init plugin is called in CLI.run but here we are not using that.
# It was called automatically in ansible-core < 2.15 but changed in https://github.com/ansible/ansible/pull/78915
init_plugin_loader()
return cli