Skip to content

ci: Comply with Ansible partner certification checking#609

Closed
richm wants to merge 1 commit intomainfrom
ci-ansible-lint-ansible-test-matrix
Closed

ci: Comply with Ansible partner certification checking#609
richm wants to merge 1 commit intomainfrom
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 [email protected]

Summary by Sourcery

Align CI Ansible linting and testing workflows with Ansible partner certification requirements by running checks via tox-lsr across multiple supported Ansible, ansible-lint, and Python versions.

CI:

  • Run ansible-lint in CI via tox-lsr against multiple ansible-lint, ansible-core, and Python versions using a matrix strategy instead of the ansible-lint GitHub Action.
  • Run ansible-test sanity checks via tox-lsr across a matrix of supported and milestone Ansible core and Python versions instead of the ansible-test GitHub Action.
  • Update all GitHub workflows to install tox-lsr from the main branch rather than a pinned 3.17.1 version.

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 <[email protected]>
@richm richm self-assigned this Apr 8, 2026
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Apr 8, 2026

Reviewer's Guide

Updates CI workflows to align with Ansible partner certification requirements by running ansible-lint and ansible-test via tox across multiple supported Ansible/Python versions and by standardizing on the latest tox-lsr from main.

Sequence diagram for updated ansible-lint CI job with version matrix

sequenceDiagram
  participant GH as GitHub_Actions
  participant Job as ansible-lint_job
  participant Matrix as Version_Matrix
  participant Py as setup-python_action
  participant Pip as pip_installer
  participant Tox as tox
  participant TL as tox-lsr
  participant AL as ansible-lint
  participant AC as ansible-core

  GH->>Job: Trigger on push_or_pull_request
  Job->>Matrix: Expand versions(24_x/2_16_x/3_12, 26_x/2_20_x/3_13)
  loop For_each_matrix_entry
    Matrix->>Py: Set_python_version(matrix.python)
    Py-->>Job: Python_ready

    Job->>Pip: pip_install(tox-lsr_from_main)
    Pip-->>TL: tox-lsr_installed

    Job->>Tox: tox -e collection,ansible-lint-collection\nLSR_ANSIBLE_LINT_DEP=ansible-lint==matrix.ansible-lint\nLSR_ANSIBLE_LINT_ANSIBLE_DEP=ansible-core==matrix.ansible
    Tox->>TL: Load_tox_lsr_configuration
    TL->>Tox: Define_collection_and_lint_envs

    Tox->>AC: Install_ansible-core(matrix.ansible)
    Tox->>AL: Install_ansible-lint(matrix.ansible-lint)

    Tox->>Job: Run_collection_conversion_and_lint
    AL-->>Tox: Lint_results
    Tox-->>Job: Job_status_for_matrix_entry
  end

  Job-->>GH: Report_combined_matrix_status
Loading

File-Level Changes

Change Details Files
Run ansible-lint via tox across a matrix of ansible-lint, ansible-core, and Python versions instead of using the ansible-lint GitHub Action on a pre-converted collection tree.
  • Add a strategy matrix to the ansible-lint workflow to exercise multiple ansible-lint, ansible-core, and Python versions
  • Upgrade tox-lsr installation to track the main branch
  • Introduce a setup-python step that selects the matrix Python version
  • Replace the manual collection conversion plus ansible-lint GitHub Action with a single tox invocation of the collection and ansible-lint-collection environments, parameterized via LSR_ANSIBLE_LINT_DEP and LSR_ANSIBLE_LINT_ANSIBLE_DEP and a basepython override
.github/workflows/ansible-lint.yml
Run ansible-test via tox across a matrix of Ansible core and Python versions instead of the ansible-test GitHub Action.
  • Add a strategy matrix to the ansible-test workflow to exercise multiple ansible-core versions (including milestone) on various Python versions
  • Upgrade tox-lsr installation to track the main branch
  • Introduce a setup-python step that selects the matrix Python version
  • Replace the ansible-test GitHub Action and separate collection conversion step with a tox run that executes the collection and ansible-test-* environments, overriding basepython per matrix entry
.github/workflows/ansible-test.yml
Standardize all CI workflows on tox-lsr from the main branch.
  • Update tox-lsr installation in managed-var comment workflow to use the main branch
  • Update tox-lsr installation in Python unit test workflow to use the main branch
  • Update tox-lsr installation in qemu-kvm integration test workflow to use the main branch
.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 found 1 issue, and left some high level feedback:

  • Using tox-lsr@main in all workflows makes CI behavior dependent on upstream changes; consider pinning to a specific tag or commit to keep the certification checks stable and reproducible.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Using `tox-lsr@main` in all workflows makes CI behavior dependent on upstream changes; consider pinning to a specific tag or commit to keep the certification checks stable and reproducible.

## Individual Comments

### Comment 1
<location path=".github/workflows/ansible-lint.yml" line_range="57" />
<code_context>
-          requirements_file: ${{ steps.collection.outputs.coll_req_file }}
-        env:
-          ANSIBLE_COLLECTIONS_PATH: ${{ github.workspace }}/.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 }}" \
</code_context>
<issue_to_address>
**issue (bug_risk):** Matrix key with a dash (`ansible-lint`) cannot be accessed via dot notation in GitHub Actions expressions.

`${{ matrix.versions.ansible-lint }}` will be interpreted as `matrix.versions - ansible - lint`, so this expression won’t resolve correctly at runtime. Please either rename the matrix key (e.g. to `ansible_lint`) and use `${{ matrix.versions.ansible_lint }}`, or access it with index syntax: `${{ matrix.versions['ansible-lint'] }}` everywhere it’s referenced.
</issue_to_address>

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.

requirements_file: ${{ steps.collection.outputs.coll_req_file }}
env:
ANSIBLE_COLLECTIONS_PATH: ${{ github.workspace }}/.tox
LSR_ANSIBLE_LINT_DEP="ansible-lint==${{ matrix.versions.ansible-lint }}" \
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (bug_risk): Matrix key with a dash (ansible-lint) cannot be accessed via dot notation in GitHub Actions expressions.

${{ matrix.versions.ansible-lint }} will be interpreted as matrix.versions - ansible - lint, so this expression won’t resolve correctly at runtime. Please either rename the matrix key (e.g. to ansible_lint) and use ${{ matrix.versions.ansible_lint }}, or access it with index syntax: ${{ matrix.versions['ansible-lint'] }} everywhere it’s referenced.

@richm richm closed this Apr 8, 2026
@richm richm deleted the ci-ansible-lint-ansible-test-matrix branch April 8, 2026 15:55
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