ci: Comply with Ansible partner certification checking [citest_skip]#139
Merged
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 <rmeggins@redhat.com>
Reviewer's GuideUpdates 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 matrixsequenceDiagram
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
Flow diagram for matrix-based ansible-lint CI pipelineflowchart 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"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 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: