ci: ansible-lint requires collection deps to be installed#240
Merged
richm merged 1 commit intolinux-system-roles:mainfrom Apr 9, 2026
Merged
Conversation
Reviewer's GuideEnsure ansible-lint runs with required collection dependencies installed and clean up how the .ansible directory and collection paths are managed in tox environments. Flow diagram for ansible-lint-collection tox environment executionflowchart TD
A["Start testenv:ansible-lint-collection"] --> B["Set basepython=python3"]
B --> C["Change directory to {toxworkdir}/ansible_collections/{env:LSR_ROLE2COLL_NAMESPACE}/{env:LSR_ROLE2COLL_NAME}"]
C --> D["Inherit generic testenv environment variables"]
D --> E["Set ANSIBLE_COLLECTIONS_PATH={toxworkdir}"]
E --> F["Run ansible-lint-helper.sh pre"]
F --> G["Run ansible-lint (with collection deps from {toxworkdir})"]
G --> H["Run ansible-lint-helper.sh post"]
H --> I["End testenv:ansible-lint-collection"]
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 left some high level feedback:
- The
yqexpressionfilter(.name != ...)inansible-lint-helper.shlooks like jq syntax and may not work with common yq versions; consider using a yq-native form like.collections |= map(select(.name != "${LSR_ROLE2COLL_NAMESPACE}.${LSR_ROLE2COLL_NAME}"))or similar and verifying against the intended yq version. - When setting
ANSIBLE_COLLECTIONS_PATH = {toxworkdir}, consider preserving any existing value (e.g.{env:ANSIBLE_COLLECTIONS_PATH:{toxworkdir}}) if you want to avoid clobbering user or CI-provided paths.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `yq` expression `filter(.name != ...)` in `ansible-lint-helper.sh` looks like jq syntax and may not work with common yq versions; consider using a yq-native form like `.collections |= map(select(.name != "${LSR_ROLE2COLL_NAMESPACE}.${LSR_ROLE2COLL_NAME}"))` or similar and verifying against the intended yq version.
- When setting `ANSIBLE_COLLECTIONS_PATH = {toxworkdir}`, consider preserving any existing value (e.g. `{env:ANSIBLE_COLLECTIONS_PATH:{toxworkdir}}`) if you want to avoid clobbering user or CI-provided paths.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
0656970 to
43a64aa
Compare
ansible-lint requires collections to be installed in order to find modules referenced. Install the collections from meta/collection-requirements.yml and tests/collection-requirements.yml, but do not install fedora.linux_system_roles. yq code generated by Claude opus-4.6 Signed-off-by: Rich Megginson <rmeggins@redhat.com>
43a64aa to
4e9a213
Compare
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.
ansible-lint requires collection deps to be installed
Signed-off-by: Rich Megginson rmeggins@redhat.com
Summary by Sourcery
Install required Ansible collections for ansible-lint runs and simplify cleanup handling in the lint helper and tox configuration.
New Features:
Enhancements:
Tests: