ci: Comply with Ansible partner certification checking#609
ci: Comply with Ansible partner certification checking#609
Conversation
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]>
Reviewer's GuideUpdates 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 matrixsequenceDiagram
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
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- Using
tox-lsr@mainin 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>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 }}" \ |
There was a problem hiding this comment.
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.
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:
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: