-
Notifications
You must be signed in to change notification settings - Fork 666
Remove code that modifies ansible import paths #4380
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
Conversation
9a7d114 to
19b6a10
Compare
As part of new test-isolation strategy, molecule will no longer take care itself about modification of: - ANSIBLE_COLLECTIONS_PATH - ANSIBLE_ROLES_PATH - ANSIBLE_LIBRARY - ANSIBLE_FILTER_PLUGINS Test isolation is supposed to be covered transparently by ansible-compat runtime when code runs inside a virtual environment. Related: https://ansible.readthedocs.io/projects/dev-tools/user-guide/test-isolation/
19b6a10 to
68c96a4
Compare
|
@ssbarnea - This breaks my In cisagov/skeleton-ansible-role#217 I tried explicitly listing the role to be tested in If there are more changes forthcoming that will fix this then I can pin to |
|
Hello, I concurr with the above comment by @jsf9k. @ssbarnea Could you please explain the correct way to upgrade to version I understand the rationale of test isolation behind the change but my feeling is that testing a local role's code is the first and most common thing people do with molecule. I think this change could deter most the maintainers of the most common OSS roles from upgrading to this version of molecule and thus following current best practices. For instance all the First thing most people will be tempted to do is pin molecule to Happy do discuss this and available to help easing the migration. |
Molecule used to modify the roles path for us, but as of v25.2.0 no longer does. (See ansible/molecule#4380 for details.) As a result we must now modify it ourselves.
|
We fixed it by explicitly setting |
|
cisagov/skeleton-ansible-role#221 shows how I am intending to work around this. Very similar to @remod's solution. |
|
Molecule and Ansible must behave in exactly the same way when searching for roles. Ansible has its own rules, and Molecule must test that Ansible will work properly in production. Changing this on the Molecule side no longer guarantees that when Ansible is running, everything will work properly. Everything's broken with this new version, and a step backwards is imperative. How does Molecule benefit from managing things differently? Adding an environment variable to return to normal operation is not an efficient solution. |
git clean -xdf
tar zcvf ../python-molecule_25.2.0.orig.tar.gz --exclude=.git .
debuild -uc -us
cp python-molecule.spec ../python-molecule_25.2.0-1.spec
cp ../python*-molecule*25.2.0*.{gz,xz,spec,dsc} /osc/home\:alvistack/ansible-community-molecule-25.2.0/
rm -rf ../python*-molecule*25.2.0*.*
See ansible#4380
Signed-off-by: Wong Hoi Sing Edison <[email protected]>
|
Once I revert this PR my CI case working fine again: |
|
@ssbarnea would you care to comment on these changes? From a user perspective, your commits through ansible-compat, molecule and even ansible-lint just broke a lot of people's workflows. The documentation is not sufficient for such drastic changes and unexpected for a minor version. |
|
Can confirm testing of all my ansible roles is now broken since update to 25.2.0. Getting the following error. Is there a workaround or update planned to release asap? |
|
These changes seem to break setups using Setting the |
|
For us this release also breaks all our roles and molecule tests... and I am not sure why. We have pretty simple and standard roles and molecule/ansible is set up via venv. I tried reading through all the linked documentation that I found and tested some approaches but none of them seem to make any difference. |
|
FWIW when running Molecule in GitLab CI you can solve this issue by adding this at the top of the variables:
ANSIBLE_ROLES_PATH: "${CI_PROJECT_DIR}/..:~/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles"This might be worth adding to the docs. |
git clean -xdf
tar zcvf ../python-molecule_25.3.1.orig.tar.gz --exclude=.git .
debuild -uc -us
cp python-molecule.spec ../python-molecule_25.3.1-1.spec
cp ../python*-molecule*25.3.1*.{gz,xz,spec,dsc} /osc/home\:alvistack/ansible-community-molecule-25.3.1/
rm -rf ../python*-molecule*25.3.1*.*
See ansible#4380
Signed-off-by: Wong Hoi Sing Edison <[email protected]>
git clean -xdf
tar zcvf ../python-molecule_25.3.1.orig.tar.gz --exclude=.git .
debuild -uc -us
cp python-molecule.spec ../python-molecule_25.3.1-1.spec
cp ../python*-molecule*25.3.1*.{gz,xz,spec,dsc} /osc/home\:alvistack/ansible-community-molecule-25.3.1/
rm -rf ../python*-molecule*25.3.1*.*
See ansible#4380
Signed-off-by: Wong Hoi Sing Edison <[email protected]>
git clean -xdf
tar zcvf ../python-molecule_25.4.0.orig.tar.gz --exclude=.git .
debuild -uc -us
cp python-molecule.spec ../python-molecule_25.4.0-1.spec
cp ../python*-molecule*25.4.0*.{gz,xz,spec,dsc} /osc/home\:alvistack/ansible-community-molecule-25.4.0/
rm -rf ../python*-molecule*25.4.0*.*
See ansible#4380
Signed-off-by: Wong Hoi Sing Edison <[email protected]>
git clean -xdf
tar zcvf ../python-molecule_25.5.0.orig.tar.gz --exclude=.git .
debuild -uc -us
cp python-molecule.spec ../python-molecule_25.5.0-1.spec
cp ../python*-molecule*25.5.0*.{gz,xz,spec,dsc} /osc/home\:alvistack/ansible-community-molecule-25.5.0/
rm -rf ../python*-molecule*25.5.0*.*
See ansible#4380
Signed-off-by: Wong Hoi Sing Edison <[email protected]>
git clean -xdf
tar zcvf ../python-molecule_25.5.0.orig.tar.gz --exclude=.git .
debuild -uc -us
cp python-molecule.spec ../python-molecule_25.5.0-1.spec
cp ../python*-molecule*25.5.0*.{gz,xz,spec,dsc} /osc/home\:alvistack/ansible-community-molecule-25.5.0/
rm -rf ../python*-molecule*25.5.0*.*
See ansible#4380
Signed-off-by: Wong Hoi Sing Edison <[email protected]>
Well, I had also trouble to find the right documentation and let's begin with it: I am still not 100% sure if it is the right documentation and why they did not bring it up somewhere or provide proper Sematic Versioning.
There seems to be Documentation, but I would argue that "Related" is not the proper way of informing about breaking changes. Combined with all recent references in this MR, I would argue that is still the case. So my conclusion for now:
Just to finalize: Communication and Semantic Versioning is an issue. |
git clean -xdf
tar zcvf ../python-molecule_25.6.0.orig.tar.gz --exclude=.git .
debuild -uc -us
cp python-molecule.spec ../python-molecule_25.6.0-1.spec
cp ../python*-molecule*25.6.0*.{gz,xz,spec,dsc} /osc/home\:alvistack/ansible-community-molecule-25.6.0/
rm -rf ../python*-molecule*25.6.0*.*
See ansible#4380
Signed-off-by: Wong Hoi Sing Edison <[email protected]>
|
I'm still not quite sure what is the recommended fix, as I didn't find one in the Molecule documentation, but I successfully run my tests after updating my provisioner:
name: ansible
env:
ANSIBLE_ROLES_PATH: ${HOME}/.ansible/rolesIndeed My take is that Molecule should deal with this stuff by itself, like before, but also I'm pretty sure this path is not portable and not bug-free. I shouldn't have to hardcode paths out of my project directory. With this, if I run Molecule on multiple projects in parallel on my local machine, these runs could have side effects. |
|
@Exagone313 I am still not able to verify, but what I can say: take a look into https://ansible.readthedocs.io/projects/dev-tools/ Yes, the molecule documentation is missing a description at the moment, but since the documentation above also explains molecule stuff, I think we will be able to achieve stuff this way. What I know so far, this seems to be intended only for collections, so no solo roles anymore. |
git clean -xdf
tar zcvf ../python-molecule_25.7.0.orig.tar.gz --exclude=.git .
debuild -uc -us
cp python-molecule.spec ../python-molecule_25.7.0-1.spec
cp ../python*-molecule*25.7.0*.{gz,xz,spec,dsc} /osc/home\:alvistack/ansible-community-molecule-25.7.0/
rm -rf ../python*-molecule*25.7.0*.*
See ansible#4380
Signed-off-by: Wong Hoi Sing Edison <[email protected]>
git clean -xdf
tar zcvf ../python-molecule_25.9.0.orig.tar.gz --exclude=.git .
debuild -uc -us
cp python-molecule.spec ../python-molecule_25.9.0-1.spec
cp ../python*-molecule*25.9.0*.{gz,xz,spec,dsc} /osc/home\:alvistack/ansible-community-molecule-25.9.0/
rm -rf ../python*-molecule*25.9.0*.*
See ansible#4380
Signed-off-by: Wong Hoi Sing Edison <[email protected]>
…'t work ansible/molecule#4380 introduced a breaking change that makes molecule not infer the path to the libraries in the plugins automatically. As these plugins are in a dynamic dir (the python libraries dir -- changes with python versions) we cannot set this in a sane way and have to work around it by composing it through a command expansion that asks the python for the library path. See: - ansible-community/molecule-plugins#301 - ansible/molecule#4391 - ansible-community/molecule-plugins#301 (comment)
…'t work ansible/molecule#4380 introduced a breaking change that makes molecule not infer the path to the libraries in the plugins automatically. As these plugins are in a dynamic dir (the python libraries dir -- changes with python versions) we cannot set this in a sane way and have to work around it by composing it through a command expansion that asks the python for the library path. See: - ansible-community/molecule-plugins#301 - ansible/molecule#4391 - ansible-community/molecule-plugins#301 (comment)
…'t work ansible/molecule#4380 introduced a breaking change that makes molecule not infer the path to the libraries in the plugins automatically. As these plugins are in a dynamic dir (the python libraries dir -- changes with python versions) we cannot set this in a sane way and have to work around it by composing it through a command expansion that asks the python for the library path. See: - ansible-community/molecule-plugins#301 - ansible/molecule#4391 - ansible-community/molecule-plugins#301 (comment)
…'t work ansible/molecule#4380 introduced a breaking change that makes molecule not infer the path to the libraries in the plugins automatically. As these plugins are in a dynamic dir (the python libraries dir -- changes with python versions) we cannot set this in a sane way and have to work around it by composing it through a command expansion that asks the python for the library path. See: - ansible-community/molecule-plugins#301 - ansible/molecule#4391 - ansible-community/molecule-plugins#301 (comment)
…'t work ansible/molecule#4380 introduced a breaking change that makes molecule not infer the path to the libraries in the plugins automatically. As these plugins are in a dynamic dir (the python libraries dir -- changes with python versions) we cannot set this in a sane way and have to work around it by composing it through a command expansion that asks the python for the library path. See: - ansible-community/molecule-plugins#301 - ansible/molecule#4391 - ansible-community/molecule-plugins#301 (comment)
…'t work ansible/molecule#4380 introduced a breaking change that makes molecule not infer the path to the libraries in the plugins automatically. As these plugins are in a dynamic dir (the python libraries dir -- changes with python versions) we cannot set this in a sane way and have to work around it by composing it through a command expansion that asks the python for the library path. See: - ansible-community/molecule-plugins#301 - ansible/molecule#4391 - ansible-community/molecule-plugins#301 (comment)
…'t work ansible/molecule#4380 introduced a breaking change that makes molecule not infer the path to the libraries in the plugins automatically. As these plugins are in a dynamic dir (the python libraries dir -- changes with python versions) we cannot set this in a sane way and have to work around it by composing it through a command expansion that asks the python for the library path. See: - ansible-community/molecule-plugins#301 - ansible/molecule#4391 - ansible-community/molecule-plugins#301 (comment)
The role resolution changed with molecule 25.2.0, making this change neccessary. See ansible/molecule#4391 and ansible/molecule#4380 for more details.
The role resolution changed with molecule 25.2.0, making this change neccessary. See ansible/molecule#4391 and ansible/molecule#4380 for more details.
git clean -xdf
tar zcvf ../python-molecule_25.11.0.orig.tar.gz --exclude=.git .
debuild -uc -us
cp python-molecule.spec ../python-molecule_25.11.0-1.spec
cp ../python*-molecule*25.11.0*.{gz,xz,spec,dsc} /osc/home\:alvistack/ansible-community-molecule-25.11.0/
rm -rf ../python*-molecule*25.11.0*.*
See ansible#4380
Signed-off-by: Wong Hoi Sing Edison <[email protected]>
git clean -xdf
tar zcvf ../python-molecule_25.11.0.orig.tar.gz --exclude=.git .
debuild -uc -us
cp python-molecule.spec ../python-molecule_25.11.0-1.spec
cp ../python*-molecule*25.11.0*.{gz,xz,spec,dsc} /osc/home\:alvistack/ansible-community-molecule-25.11.0/
rm -rf ../python*-molecule*25.11.0*.*
See ansible#4380
Signed-off-by: Wong Hoi Sing Edison <[email protected]>
git clean -xdf
tar zcvf ../python-molecule_25.11.0.orig.tar.gz --exclude=.git .
debuild -uc -us
cp python-molecule.spec ../python-molecule_25.11.0-1.spec
cp ../python*-molecule*25.11.0*.{gz,xz,spec,dsc} /osc/home\:alvistack/ansible-community-molecule-25.11.0/
rm -rf ../python*-molecule*25.11.0*.*
See ansible#4380
Signed-off-by: Wong Hoi Sing Edison <[email protected]>
git clean -xdf
tar zcvf ../python-molecule_25.11.1.orig.tar.gz --exclude=.git .
debuild -uc -us
cp python-molecule.spec ../python-molecule_25.11.1-1.spec
cp ../python*-molecule*25.11.1*.{gz,xz,spec,dsc} /osc/home\:alvistack/ansible-community-molecule-25.11.1/
rm -rf ../python*-molecule*25.11.1*.*
See ansible#4380
Signed-off-by: Wong Hoi Sing Edison <[email protected]>
git clean -xdf
tar zcvf ../python-molecule_25.12.0.orig.tar.gz --exclude=.git .
debuild -uc -us
cp python-molecule.spec ../python-molecule_25.12.0-1.spec
cp ../python*-molecule*25.12.0*.{gz,xz,spec,dsc} /osc/home\:alvistack/ansible-community-molecule-25.12.0/
rm -rf ../python*-molecule*25.12.0*.*
See ansible#4380
Signed-off-by: Wong Hoi Sing Edison <[email protected]>
As part of new test-isolation strategy, molecule will no longer take
care itself about modification of:
Test isolation is supposed to be covered transparently by ansible-compat runtime when code runs inside a virtual environment. Molecule is already using it for running all its external commands.
Related: https://ansible.readthedocs.io/projects/dev-tools/user-guide/test-isolation/