Skip to content
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

Recursive symlink created in .cache can prevent pip from installing current repository #1566

Closed
ssbarnea opened this issue May 21, 2021 · 5 comments · Fixed by #1567
Closed
Assignees
Labels
bug feedback-needed Divergent oppinions, additional feedback is desired in order to unblock it.

Comments

@ssbarnea
Copy link
Member

Upstream bug pypa/pip#10005 can prevent users of ansible-lint and molecule from installing current repository, as pip would endup with an endless loop trying to copy the code.

We rely on those symlinks in order to avoid copying the source code inside the ansible-environments (where we keep roles and collections used during testing).

As even if pip fixes the bug we will continue to see such problems with users that use older versions of pip, we should consider which workarounds we have. So far I identified:

  1. change .cache directory default to be .tox/.cache as this folder is ignored by pip by default. This is low effort and low risk approach
  2. as @tadeboro suggested, start using ~/.cache for caching. This requires us to use a hash to distinguish between various repositories and also makes me wonder if it may cause other problems when home directory may not be on the same partition as the project_dir, as I am not sure if those symlinks would work. Cleaning up that centralized .cache is another issue that concerns me but we can delay fixing it for a later time (not really being a blocker).
@ssbarnea ssbarnea added the bug label May 21, 2021
@ssbarnea ssbarnea self-assigned this May 21, 2021
@ssbarnea ssbarnea added the feedback-needed Divergent oppinions, additional feedback is desired in order to unblock it. label May 21, 2021
ssbarnea added a commit that referenced this issue May 21, 2021
ssbarnea added a commit that referenced this issue May 21, 2021
- instead of in-repo .cache folder make use of ~/.cache
- use a hash based on project_dir path to avoid cross-contamination
  between various projects

Fixes: #1566
ssbarnea added a commit that referenced this issue May 21, 2021
- instead of in-repo .cache folder make use of ~/.cache
- use a hash based on project_dir path to avoid cross-contamination
  between various projects

Fixes: #1566
ssbarnea added a commit that referenced this issue May 21, 2021
- instead of in-repo .cache folder make use of ~/.cache
- use a hash based on project_dir path to avoid cross-contamination
  between various projects

Fixes: #1566
@alessfg
Copy link
Contributor

alessfg commented Jun 2, 2021

Given the change in the default .cache location to ~/.cache, should the .cache location excluded in #1479 also be modified to reflect the new location?

@ssbarnea
Copy link
Member Author

ssbarnea commented Jun 3, 2021

There is no need to exclude ~/.cache because is outside current repository anyway, which is almost for sure a subfolder inside user home, or anywhere else, but still never a folder that includes user home directory.

@alessfg
Copy link
Contributor

alessfg commented Jun 4, 2021

That makes sense -- however, in that case, do you have any suggestions on how to prevent the linter from linting external roles installed by molecule's requirements file (example here)? (I can open a new issue if you think this might be an actual issue instead of PBKAC.)

@ssbarnea
Copy link
Member Author

ssbarnea commented Jun 4, 2021

Just upgrade molecule and the linter to latest versions, remove existing in-repo .cache folder(s) and run again, it should work fine.

@alessfg
Copy link
Contributor

alessfg commented Jun 7, 2021

So I upgraded both Molecule to 3.3.4 and Ansible lint to 5.0.12, reran the tests and I'm still seeing the same error, both when executing ansible-lint on its own, and when executing molecule lint. When executing ansible-lint on its own, I can use the --offline flag to workaround the issue, but molecule installs dependencies before linting as part of its workflow. The issue in the GitHub actions workflow I'm running seems to potentially be due to the ANSIBLE_ROLES_PATH used by Ansible lint?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug feedback-needed Divergent oppinions, additional feedback is desired in order to unblock it.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants