Skip to content

ci: add ansible-test versions for each ansible version#236

Merged
richm merged 1 commit intolinux-system-roles:mainfrom
richm:add-ansible-test-versions
Mar 30, 2026
Merged

ci: add ansible-test versions for each ansible version#236
richm merged 1 commit intolinux-system-roles:mainfrom
richm:add-ansible-test-versions

Conversation

@richm
Copy link
Copy Markdown
Contributor

@richm richm commented Mar 30, 2026

This allows us to have the right combinations of ansible-core, python, and
the ansible version in order to run every different version of ansible-test.

We need this because AAP Automation Hub gating, and EL, all use different
versions of ansible-test, and we need to test with and pass all of them.

Signed-off-by: Rich Megginson rmeggins@redhat.com

Summary by Sourcery

Add dedicated tox environments and collection version handling to support running ansible-test against multiple ansible-core and Python version combinations.

Enhancements:

  • Introduce LSR_COLLECTION_VERSION handling in ansible-test and collection helper scripts to align collection requires_ansible metadata with the targeted ansible-test version.

Tests:

  • Add tox environments for ansible-test 2.14 through 2.20 with corresponding Python and ansible-core versions, and update test fixture configuration accordingly.

This allows us to have the right combinations of ansible-core, python, and
the ansible version in order to run every different version of ansible-test.

We need this because AAP Automation Hub gating, and EL, all use different
versions of ansible-test, and we need to test with and pass all of them.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Mar 30, 2026

Reviewer's Guide

Adds dedicated tox environments for specific ansible-test / ansible-core / Python version combinations and wires them to set a collection version used to enforce compatible requires_ansible in meta/runtime.yml and collection builds.

File-Level Changes

Change Details Files
Introduce dedicated tox testenvs for ansible-test versions 2.14 through 2.20, each bound to a specific Python and ansible-core version and configured to run ansible-test in Docker.
  • Add seven new [testenv:ansible-test-X-Y] sections mapping ansible-test versions 2.14–2.20 to specific basepython versions (3.9–3.14).
  • Configure each new testenv to enable Docker-based ansible-test runs via LSR_ANSIBLE_TEST_DOCKER=true.
  • Set LSR_COLLECTION_VERSION in each testenv to the matching Ansible collection version (e.g., 2.14.0, 2.15.0) and use LSR_ANSIBLE_TEST_DEP to pin ansible-core to the corresponding major.minor series.
src/tox_lsr/config_files/tox-default.ini
Extend tox merge fixture to reflect the new ansible-test environments for configuration testing.
  • Mirror the newly added ansible-test tox environments in the result.ini fixture used by tox_merge_ini tests, keeping basepython, env vars, deps, and commands consistent with tox-default.ini.
tests/fixtures/test_tox_merge_ini/result.ini
Propagate collection version into runtime metadata so ansible-test sees a compatible requires_ansible constraint.
  • Update runansible-test.sh to, when LSR_COLLECTION_VERSION is set, rewrite the requires_ansible field in meta/runtime.yml to ">=<LSR_COLLECTION_VERSION>" before running ansible-test.
  • Update runcollection.sh to similarly rewrite requires_ansible in the generated collection's meta/runtime.yml based on LSR_COLLECTION_VERSION, ensuring collection builds and tests share the same constraint.
src/tox_lsr/test_scripts/runansible-test.sh
src/tox_lsr/test_scripts/runcollection.sh

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The new ansible-test tox environments are almost identical apart from version numbers and basepython; consider factoring this into a parametrized pattern (e.g., using tox factors or common ini substitutions) to reduce duplication and ease future updates.
  • The sed replacement of requires_ansible in both runansible-test.sh and runcollection.sh assumes the key exists and is left‑aligned; you may want to handle the case where requires_ansible is missing or indented, and/or centralize this logic in a shared helper to avoid divergence between the two scripts.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new ansible-test tox environments are almost identical apart from version numbers and basepython; consider factoring this into a parametrized pattern (e.g., using tox factors or common ini substitutions) to reduce duplication and ease future updates.
- The `sed` replacement of `requires_ansible` in both `runansible-test.sh` and `runcollection.sh` assumes the key exists and is left‑aligned; you may want to handle the case where `requires_ansible` is missing or indented, and/or centralize this logic in a shared helper to avoid divergence between the two scripts.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@richm richm merged commit 2fdcb9f into linux-system-roles:main Mar 30, 2026
8 checks passed
@richm richm deleted the add-ansible-test-versions branch March 30, 2026 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant