-
Notifications
You must be signed in to change notification settings - Fork 665
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
Dependencies are re-downloaded on every run #1641
Comments
Yes please!!! This should be milestoned for the next release IMHO. |
This is actually built in, but the default is to download every time. Here is the specific line which configures the default: https://github.com/ansible/molecule/blob/master/molecule/dependency/ansible_galaxy.py#L84-L85 Check out this example molecule.yml file which shows this option. ---
dependency:
name: galaxy
options:
force: False
driver:
name: docker
lint:
name: yamllint
platforms:
- name: instance
image: centos:7
provisioner:
name: ansible
lint:
name: ansible-lint
scenario:
name: default
verifier:
name: testinfra
lint:
name: flake8 The question becomes whether we want to change the default from forcing a download. I can see both ways, but if anyone else wants to chime in that would be great! Either way we should change the documentation to reflect this option. This can be found here: https://github.com/ansible/molecule/blob/master/molecule/dependency/ansible_galaxy.py#L47-L52 |
it should work the way ansible-playbook and ansible-galaxy works imo |
The problem with |
Then it should be EDIT: When using ansible-galaxy, you have to pass -f to force (not default) |
Sticking with the ansible-galaxy default makes sense to me. I think. @manics I think for that use case you should specify force: True in your molecule config. Since the dependency check is just a wrapper around ansible-galaxy I think the sane default would mirror ansible-galaxy's sane default |
@ragingpastry The problem with
Install role version 1.0.0:
Update to version 1.0.1, it fails without
But rerunning with
|
I understand why force could be problematic. I don't see how Molecule should be solving this problem though. It already provides an interface for modifying the options passed to ansible-galaxy. Maybe I am misunderstanding what you are saying. I think that changing the default ansible-galaxy option in Molecule to align with ansible-galaxy's own defaults make sense. |
I'm not sure about removing Without it you might bump a required version (either intentionally, or from a git pull) without realising the downloaded role is out of date. Since there's no ideal solution at the moment could molecule check the status from ansible-galaxy and perhaps fail if there's a role mismatch? |
Just my 2cts, but i had the same concern even without molecule and this behaviour should be fix on the ansible-galaxy/mazer side. Regards, |
Closing out based on two points:
Let's put some pressure on galaxy/mazer 👍 |
@rgarrigue has come to chat about this on IRC and I'm re-opening. |
This can be seen when using roles from tar files as they aren't perceived to have "versions" even if the URL changes if the rolename is the same it assumes it's the correct role. |
I am closing this because this is more of a limitation of galaxy and there is not much molecule can do about it. Still, this does not mean that a PR related to this ticket would not be appreciated. |
I recently started using the molecule to integrate my project's Ansible roles into the CI/CD process and quickly ran into two problems:
After much research and many attempts, I found the following solution: .env.yml ---
ANSIBLE_ROLES_PATH: galaxy_roles .gitignore
molecule/default/molecule.yml ---
dependency:
name: shell
command: ansible-galaxy install -r meta/requirements.yml -p galaxy_roles/ --force
driver:
name: docker
platforms:
- name: molecule-ubuntu
image: ubuntu
pre_build_image: true
provisioner:
name: ansible
verifier:
name: ansible
lint: |
set -e
yamllint .
ansible-lint This way, just by changing I hope it's useful to someone. |
In fact if you are using latest version of molecule, it will install repository revel requirements.yml itself without you having to add anything to molecule.yml file. You are better of removing dependency block from molecule config. In fact molecule own logic is smarter than galaxy itself and installs dependencies only when they are missing (galaxy from 2.9 does not support that, not even ability to upgrade them). |
Thanks for your reply ssbarnea, but in may case I using my own dependencies from my git repository, and when I changed something and doesn't change the tag, the molecule not will force the dependence update, it executes the command without "--force" flag, and I am using the latest version of molecule. And with the solution that I proposed, I didn't need add a an additional "dependencies.yml" to the root project folder, it will consume the meta/dependencies.yml directly from the role. |
Issue Type
Molecule and Ansible details
Molecule installation method (one of):
Ansible installation method (one of):
Detail any linters or test runners used: Ubuntu 18.04 in Docker
Desired Behavior
Galaxy should download only once instead of every run, especially if it already exists and the version matches
Actual Behaviour
First run
Second run
molecule/default/requirements.yml
molecule/default/mocule.yml (snippet)
The text was updated successfully, but these errors were encountered: