-
Notifications
You must be signed in to change notification settings - Fork 654
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
Offline mode doesn't work with ANSIBLE_COLLECTIONS_PATH #2683
Comments
Just to be clear, we do install collections and roles before attempting to run ansible-lint. |
Same problem here. Ansible lint 6.x seems pretty unstable right now. :( |
FYI this is still broken in ansible-lint 6.9.0. |
Is this supposed to work in 6.9.1? Collections are not detected (
It is impossible to download collections on every CI/CD pipeline run, it takes several minutes. |
@nre-ableton One of the scopes of ansible-lint is to check that the developer got all requirements in place, basically that he did not forget to mention some of them in his requirements.yml file and the code just happened to work on his machine, just to crash later in production. In order to be able to test the presence of requirements, by default ansible-lint runs in insolation, meaning that it will tell ansible to not look for collections anywhere else than the special location used by ansible-lint. So it will prevent ansible from finding collections installed in default system location, or user default location. Check ansible-lint/src/ansiblelint/app.py Line 48 in 884d098
At this moment we did not add an option to disable the isolation mode but that could be quite easy. Still, you need to be aware that by disabling the isolation mode it means that ansible-lint will install and potentially override collections that you might already have installed. Still, this can be avoided by adding the Basically it is a feature, not a bug. A feature that ensures that the tool will produce the same results on all machines, regardless what goodies (collections, roles) the user installed in his own machine. I hope this explains it. Let me know what you think and what should we do, maybe we should also open a discussion in order to decide which changes should be made to accomodate for various use cases. |
@ssbarnea that feature should perhaps be documented. I could not see it documented and on the contrary this documentation fragment seemed to be now then outdated:
Regarding your explanation (thank you!) it seems you are only considering one use case, that of a development workstation. Edit: the simplest workaround for this issue is to simply rename/delete Edit 2: another misleading documentation at configuration documentation says
|
Please provide a way for not using the isolated runtime or make it implied with --offline. For my use case, I ship the depencies in the container image, and do not need to download them again. |
@rgl That is indeed a good point. I think that most reasons for Still, this opens another question: Should offline mode also disable the mocking support? Somehow I have the impression that we don't want to accidentally mock anything and ignore the missing dependencies when doing so. If that would be against other use-cases of offline, we might have to add a new command line option that describes this mode. |
@ssbarnea, sorry, but I do not known about ansible-lint mocking. I'm not familiar with mocking in this context (which I assume, you are referring to |
@ssbarnea Fair enough, but as noted by others, this is only one use-case. The other use-case is obviously CI installations and similar. Actually, we only run our production playbooks from a CI-like server, because we precisely don't want to end up in a situation where something worked on a developer's machine because they installed a role/collection that wasn't added to
It would be nice if there was an option (either from the CLI or in Also, regarding ansible-lint role mocking, I wasn't aware of that feature, but I don't think it's a great option (at least in my use-case) because (a) we rely on a ton of roles, and (b) we also rely on collections, and I want ansible-lint to inspect code that uses said collections. Rather than opening a new discussion, let's continue this conversation at #2786. |
Summary
The recently-fixed
--offline
mode no longer works when collections are expected to be found outside of~/.cache/ansible-compat/<hash>
.Issue Type
Ansible and Ansible Lint details
OS / ENVIRONMENT
Ubuntu-ish Linux 22.04.
STEPS TO REPRODUCE
Running
ansible-lint
on our repository now fails, even whenANSIBLE_COLLECTIONS_PATH
is set correctly:Related to #2651, but I'm not 100% sure that it's the same problem, so I opened another issue. Apologies if this issue should be treated as a dupe.
The text was updated successfully, but these errors were encountered: