-
Notifications
You must be signed in to change notification settings - Fork 662
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
molecule fails in GitHub actions with: ansible_compat.errors.InvalidPrerequisiteError: Collection 'community.docker' not found in '['/home/runner/.ansible/collections', '/usr/share/ansible/collections']' #4017
Comments
Also tried with explicitly staying at 5:
same issue, so maybe
|
I'm running into this as well. For a workaround, I've started pinning to the following versions and molecule runs as expected
|
Also running into this issue starting a day or two ago. |
* Pin dependencies due to failing build. See: ansible/molecule#4017 Workaround: ansible/molecule#4017 (comment) * Add issue and workaround as comment
tested a bit, miminal version of this is:
edit: confirmed that the min pin from @zerwes below works:
|
Here is a minimal test case to reproduce this issue (while preparing this test case I've found out that the issue had been already submitted): python3 -m venv /tmp/molecule
/tmp/molecule/bin/pip3 install ansible molecule molecule-docker
mkdir /tmp/role
cd /tmp/role
mkdir -p molecule/default
echo '{driver: {name: docker}, platforms: [{name: instance, image: 'ubuntu:22.04'}]}' > molecule/default/molecule.yml
/tmp/molecule/bin/molecule create Possible temporary workaround: export ANSIBLE_COLLECTIONS_PATH=/tmp/molecule/lib/python3.10/site-packages
/tmp/molecule/bin/molecule create |
@giner Thanks for the minimal repro. There was a change in ansible-core 2.15.3 related to ansible-galaxy and it's default behaviour related to installing collections, I think this is related (ansible/ansible#81515) If I switch to core 2.15.2, we can see the molecule has installed the collections in my ~/.ansible:
Still digging........... |
Additional finding, if only |
Do we need to add a force parameter in this function? Do you need to consider to bring isolated environment back? |
Still looking..........getting to know the code. I'm trying to figure out why the ansible-galaxy install command finds the collections installed via ansible into the venv but the compat doesn't.
I suspect compat is not using the sys paths like core........ |
I think this is the logic compat needs to emulate: https://github.com/ansible/ansible/blob/9afaf2216b0bf38cfbd9a0c93409959f78d01820/lib/ansible/utils/collection_loader/_collection_finder.py#L254 Candidate collection paths include sys.paths unless configured otherwise. Looking deeper into compat to see where it should go |
pin ansible version |
* interim fix : pin latest ansible version due to ansible/molecule#4017 * interim fix : pin latest ansible version due to ansible/molecule#4017
It seems that |
@milliams thanks for confirming this :) |
@milliams TY |
@ajinkyau Please add a change that requires the new version of compat for closing this bug in molecule. |
Works for me as well. @wookietreiber I guess this issue can be closed? |
Yeah, it works for me now as well. I'd close too but wanted to wait for @ssbarnea and @ajinkyau. |
Issue Type
Molecule and Ansible details
Molecule installation method (one of):
Ansible installation method (one of):
Detail any linters or test runners used: I don't understand what is meant by this. I have made a branch of my role so you can look at the molecule and GitHub action configuration here.
Desired Behavior
It should just work.
Actual Behaviour
For the full output of the action/workflow, see here.
Notes
I've tried around a bit with (neither helped):
adding
ansible-galaxy collection install community.docker
to the action, output said it was already installed (probably viapip3 install ansible
from the action)adding a
requirements.yml
including the community.docker collection andwhich didn't help because that would require molecule to start which it doesn't
I don't know if I'm doing something wrong here or if that's a bug with the recent 6.x release. I've had this setup with a few other roles before and it worked, likely with 5.x.
The text was updated successfully, but these errors were encountered: