-
Notifications
You must be signed in to change notification settings - Fork 640
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_COLLECTION_PATH is no longer set by ansible-compat and collections are not found. #3344
ANSIBLE_COLLECTION_PATH is no longer set by ansible-compat and collections are not found. #3344
Comments
Only |
Hi @ssbarnea , Please have a look at the minimal example. It is a 100% reproduction. The collections are downloaded as specified in the requirements.yml but it seems, that the The essential part is, that when there is no system wide or user wide collection installation which would have been picked up by the default paths. This is basically my workaround. Install the collections in a system path in the container which does the linting. The issue might be related to the recent changes to the collection path search in ansible-compat (https://github.com/ansible/ansible-compat/blob/2c70ee26d3b04f17084377adbc25102117c10118/src/ansible_compat/runtime.py#L148). |
Same issue here, example output in a github action run: https://github.com/mgit-at/ansible-collection-roles/actions/runs/4806675854/jobs/8554484759?pr=36 |
I have the same issue with DebOps project, an example CI output: https://github.com/debops/debops/actions/runs/4799604148/jobs/8539449676#step:5:1 I managed to tell |
Yeah, this might be a workaround for now to get 6.15.0 running in CI, but I don't really want to distribute |
I'm not sure how feasible is setting a variable, since we need to know the |
I will be back to this bug and fix it before we make the next release. Now that I see get some extra feedback from you regarding #2802 question. Be sure that you vote there as I did not see a big enough number of votes. The current magic The only downside that I see with this approach is that people will need to add the collections folder to their |
@ssbarnea I'm fine with using |
For me the question remains: Why do we still set What about a two stage approach:
|
This patch ensures that ansible-lint can find both DebOps collections included in the monorepo as well as dependent collections installed in the '~/.cache/ansible-compat/` path. To do this reliably, we create a stub 'ansible.cfg' file in the root of the repository which tells ansible-lint where it can find Ansible Collections. This needs to be generated dynamically because 'ansible-compat' uses a hashed path in the '~/.cache/' directory to store downloaded connections. Since ansible-playbook will also use the generated 'ansible.cfg' during syntax check, we need to install the dependent collections manually for this test to work. Ref: ansible/ansible-lint#3344
@ssbarnea I was able to handle dependent collections in a "normal" |
Summary
I'm running ansible-lint using pre-commit. While updating to 6.15.0 pre-commit created a new environment and installed all dependencies freshly.
Ansible-lint now fails to find the collections which are correctly installed by ansible-compat. I have verified the folder in ~/.cache/ansible-compat and they are there. I also noticed that
ANSIBLE_COLLECTION_PATH
is no longer set.The special thing about my setup is, that I have no system wide ansible or collection installation, so it all lives within pre-commit/ansible-compat.
I also noticed that, during linting a collection, as a fallback it tried to install the collection itself when something before that failed. After temporarily removing the galaxy.yml this no longer happens.
Issue Type
OS / ENVIRONMENT
Which is 6.15 installed by pre-commit cloning the repo.
STEPS TO REPRODUCE
docker run --rm -it docker.io/library/python:3.11-slim-bullseye bash
Inside the contain run:
Desired Behavior
Linting should work just fine.
Actual Behavior
The text was updated successfully, but these errors were encountered: