-
Notifications
You must be signed in to change notification settings - Fork 673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ansible-lint doesn't make use of collection installed for the first time #3636
Comments
I think this issue makes the ansible-lint GitHub action unusable if you are using any module outside Ansible core. There's no opportunity to run ansible-galaxy by hand between the installation and execution of ansible-lint, so you need to rely on its implicit processing of |
I can confirm this happening in latest Workaround is to run |
In Issue #3942 user veksh also showed an alternative solution for this when using the GitHub Action, which was to do as you suggested. Since @cla86 found that running it a second time works, I tested that in my GitHub workflow with success. Is it faster than writing a command to update packages, install pip, install Ansible, and then running the command? Probably, I didn't try to be honest, but this is working well for me now in my runners. We know that a second run will work, and all it takes is running jobs:
build:
name: Ansible Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# This runs twice, once to install the collections and roles, because
# the current action is unable to resolve FQCN for modules on first pass
- name: Install required collections and roles
uses: ansible/ansible-lint@v24
with:
args: "collections/requirements.yml -v"
- name: Run ansible-lint
uses: ansible/ansible-lint@v24
with:
args: "-v" |
Hey folks, I've been looking into this as I noticed when using the GitHub action, On my fork, I've implemented a new optional input for the action called Usage example: https://github.com/dbrennand/home-ops/blob/dev/.github/workflows/ansible-lint.yml#L15 I'll be raising a PR for this shortly 🙂 |
Summary
ansible-lint doesn't make use of collection installed for the first time
Issue Type
OS / ENVIRONMENT
This is docker image setup for CI/CD pipeline based on docker.io/library/python:3.11.4-bullseye only with ansible-core and ansible-lint
STEPS TO REPRODUCE
Desired Behavior
ansible-lint should analyze ansible content upon installed collections.
Possible security bugs should be reported via email to
security@ansible.com
Actual Behavior
Running ansible-lint for the first time it installs collections from requirements.yml file, but doesn't make use of it producing warnings about not being able to resolve module from collections.
Running ansible-lint second time works as expected
The text was updated successfully, but these errors were encountered: