Skip to content

ci: Comply with Ansible partner certification checking [citest_skip]#139

Merged
richm merged 1 commit into
mainfrom
ci-ansible-lint-ansible-test-matrix
Apr 8, 2026
Merged

ci: Comply with Ansible partner certification checking [citest_skip]#139
richm merged 1 commit into
mainfrom
ci-ansible-lint-ansible-test-matrix

Conversation

@richm
Copy link
Copy Markdown
Contributor

@richm richm commented Apr 8, 2026

https://github.com/ansible-collections/partner-certification-checker/blob/main/README.md

Unfortunately we cannot use the checkers provided by their team because they assume
the git repo is in collection format - you cannot convert to collection format first
then point the checkers at that collection. Instead, implement our own checkers that
do the same (and more) - check with multiple versions of ansible-lint and ansible-test
to ensure we cover:

  • all supported versions of EL
  • Automation Hub gating
  • the latest versions of Ansible, including the latest milestone version

This requires the latest version of tox-lsr

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

Summary by Sourcery

Align CI Ansible checks with partner certification requirements by running ansible-lint and ansible-test via tox across multiple supported Ansible and Python versions.

CI:

  • Run ansible-lint in CI via tox-lsr against a version matrix that covers Automation Hub gating and latest Ansible/ansible-lint combinations.
  • Run ansible-test sanity checks in CI via tox across a matrix of supported Ansible and Python versions, including milestone releases.
  • Upgrade all GitHub workflows to use tox-lsr 3.18.0 instead of 3.17.1.

https://github.com/ansible-collections/partner-certification-checker/blob/main/README.md

Unfortunately we cannot use the checkers provided by their team because they assume
the git repo is in collection format - you cannot convert to collection format first
then point the checkers at that collection.  Instead, implement our own checkers that
do the same (and more) - check with multiple versions of ansible-lint and ansible-test
to ensure we cover:

* all supported versions of EL
* Automation Hub gating
* the latest versions of Ansible, including the latest milestone version

This requires the latest version of tox-lsr

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
@richm richm self-assigned this Apr 8, 2026
@richm richm requested a review from spetrosi as a code owner April 8, 2026 22:00
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Apr 8, 2026

Reviewer's Guide

Updates GitHub Actions CI to align with Ansible partner certification expectations by running ansible-lint and ansible-test via tox-lsr across multiple Ansible/Python versions, and bumps tox-lsr to 3.18.0 everywhere.

Sequence diagram for ansible-lint job using tox-lsr matrix

sequenceDiagram
  actor Dev as Developer
  participant GH as GitHubActions
  participant WF as Workflow_ansible_lint_yml
  participant Job as Job_ansible_lint
  participant Matrix as Strategy_matrix_versions
  participant SetupPy as Step_Setup_Python
  participant InstallToxLsr as Step_Install_tox_lsr_3_18_0
  participant RunToxLint as Step_Run_tox_collection_and_ansible_lint_collection
  participant Tox as tox
  participant ToxLsr as tox_lsr_3_18_0
  participant EnvCollection as tox_env_collection
  participant EnvLintCollection as tox_env_ansible_lint_collection
  participant AnsibleLint as ansible_lint
  participant AnsibleCore as ansible_core

  Dev->>GH: Push or open pull_request
  GH->>WF: Trigger workflow ansible-lint.yml
  WF->>Job: Start job ansible-lint
  Job->>Matrix: Expand matrix over versions

  loop For each matrix entry
    Matrix->>SetupPy: Configure python-version
    SetupPy->>Job: Python runtime ready

    Job->>InstallToxLsr: pip install tox and tox-lsr 3.18.0
    InstallToxLsr->>ToxLsr: Make tox-lsr available

    Job->>RunToxLint: Run tox with env collection, ansible-lint-collection
    RunToxLint->>Tox: Invoke tox -e collection,ansible-lint-collection
    Tox->>EnvCollection: Run collection env (convert role to collection)
    EnvCollection-->>Tox: Collection layout prepared

    Tox->>EnvLintCollection: Run ansible-lint-collection env
    EnvLintCollection->>AnsibleLint: Install ansible-lint for matrix version
    EnvLintCollection->>AnsibleCore: Install ansible-core for matrix version
    EnvLintCollection->>AnsibleLint: Execute ansible-lint against collection
    AnsibleLint-->>EnvLintCollection: Lint results
    EnvLintCollection-->>Tox: Exit status per matrix entry
  end

  Tox-->>Job: Aggregated status across matrix
  Job-->>WF: Job result
  WF-->>GH: Report check status on PR/commit
Loading

Flow diagram for matrix-based ansible-lint CI pipeline

flowchart TD
  A["Start: PR or push event"] --> B["Evaluate [citest_skip] condition"]
  B -->|Skip| Z["End: CI ansible-lint skipped"]
  B -->|Run| C["Initialize ansible-lint job"]
  C --> D["Define matrix versions
  ansible-lint 24.*, ansible-core 2.16.*, python 3.12
  ansible-lint 26.*, ansible-core 2.20.*, python 3.13"]
  D --> E["For each matrix entry"]

  subgraph LoopPerMatrixEntry["Per matrix entry"]
    E --> F["Set up Python via actions/setup-python@v6
    python-version = matrix.versions.python"]
    F --> G["pip install tox and tox-lsr 3.18.0"]
    G --> H["Run tox
    LSR_ANSIBLE_LINT_DEP = ansible-lint==matrix.versions.ansible_lint
    LSR_ANSIBLE_LINT_ANSIBLE_DEP = ansible-core==matrix.versions.ansible
    tox -x testenv:ansible-lint-collection.basepython=python{matrix.versions.python}
    -e collection,ansible-lint-collection"]
    H --> I["tox env collection converts role to collection"]
    I --> J["tox env ansible-lint-collection runs ansible-lint
    with specified ansible-core"]
    J --> K["Record lint status for this matrix entry"]
  end

  K --> L{"All matrix entries passed?"}
  L -->|No| M["Mark ansible-lint job as failed"]
  L -->|Yes| N["Mark ansible-lint job as successful"]
  M --> O["Report status back to GitHub Checks"]
  N --> O
  O --> P["End: CI ansible-lint completed across versions"]
Loading

File-Level Changes

Change Details Files
Run ansible-lint via tox across a matrix of Ansible/ansible-lint/Python versions instead of the ansible-lint GitHub Action.
  • Add a fail-fast=false matrix strategy defining two ansible-lint/ansible-core/Python version combinations.
  • Upgrade tox-lsr used in the workflow from 3.17.1 to 3.18.0.
  • Replace bespoke collection-conversion plus ansible-lint GitHub Action usage with a single shell step that sets ansible/ansible-lint dependency env vars and invokes tox environments collection and ansible-lint-collection with the matrix-selected Python interpreter.
.github/workflows/ansible-lint.yml
Run ansible-test via tox across a matrix of supported/milestone Ansible/Python versions instead of the ansible-test GitHub Action.
  • Add a fail-fast=false matrix strategy covering multiple ansible-core branches (2-14 through 2-20) plus milestone, each mapped to an appropriate Python version.
  • Upgrade tox-lsr used in the workflow from 3.17.1 to 3.18.0.
  • Replace the ansible-test GitHub Action invocation with a shell step that runs tox environments collection and ansible-test-, parameterized by the matrix-selected Ansible and Python versions.
.github/workflows/ansible-test.yml
Align remaining CI workflows on tox-lsr 3.18.0.
  • Update tox-lsr version from 3.17.1 to 3.18.0 in the ansible-managed-var-comment workflow.
  • Update tox-lsr version from 3.17.1 to 3.18.0 in the python-unit-test workflow.
  • Update tox-lsr version from 3.17.1 to 3.18.0 in the qemu-kvm-integration-tests workflow.
.github/workflows/ansible-managed-var-comment.yml
.github/workflows/python-unit-test.yml
.github/workflows/qemu-kvm-integration-tests.yml

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 reviewed your changes and they look great!


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 92ce871 into main Apr 8, 2026
14 checks passed
@richm richm deleted the ci-ansible-lint-ansible-test-matrix branch April 8, 2026 22:10
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