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

podman plugin does not download dependencies of roles when importing #209

Open
staticdev opened this issue Nov 18, 2023 · 4 comments
Open

Comments

@staticdev
Copy link

staticdev commented Nov 18, 2023

I have a repo of an ansible role tested with molecule for some years now. Without a real change, my tests started failing on August 2023 when I import my role due to its dependencies on meta/main.yml.

I see on an early step:

Molecule default > dependency
  Starting galaxy role install process
  - staticdev.pyenv (2.10.2) is already installed, skipping.
  INFO     Dependency completed successfully.
  WARNING  Skipping, missing the requirements file.

For some reason I get the error:

  TASK [Include staticdev.python_developer] **************************************
  ERROR! the role 'staticdev.pyenv' was not found in ansible.legacy:/home/runner/work/ansible-role-python-developer/ansible-role-python-developer/staticdev.python_developer/molecule/default/roles:/home/runner/.cache/molecule/staticdev.python_developer/default/roles:/home/runner/work/ansible-role-python-developer/ansible-role-python-developer:/home/runner/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/home/runner/work/ansible-role-python-developer/ansible-role-python-developer:/home/runner/work/ansible-role-python-developer/ansible-role-python-developer/staticdev.python_developer/molecule/default
  
  The error appears to be in '/home/runner/work/ansible-role-python-developer/ansible-role-python-developer/staticdev.python_developer/meta/main.yml': line 37, column 5, but may
  be elsewhere in the file depending on the exact syntax problem.
  
  The offending line appears to be:
  
  dependencies:
    - name: staticdev.pyenv
      ^ here

The role exists on Ansible Galaxy with correct version. This error only happens on Github Actions, but not locally. I do not really understand why, but on my path locally molecule can find staticdev.pyenv and can import statically. Do I need to add anything extra to install the requirements?

I tried found a change in the docs for syntax of role-file to requirements-file, but both syntaxes give the same failure:

dependency:
  name: galaxy
  options:
    requirements-file: requirements.yml
@zhan9san
Copy link
Member

zhan9san commented Dec 2, 2023

@staticdev

Sorry to make you confused. I don't find any dependency in the repo you provided.

Please follow this document to set the dependency for molecule, https://ansible.readthedocs.io/projects/molecule/configuration/#dependency

And if the dependency is for the role itself, it should be in meta/main.yaml while if the dependency is only for the molecule test, it should be in molecule.yaml

Let me know if it works for you

@staticdev
Copy link
Author

staticdev commented Dec 2, 2023

Thanks for your answer @zhan9san! Actually I always had the dependency for my role on meta/main.yml, I also tried adding in addition to there, also on dependency.yml and configure both role-file and requirements-file to dependency.yml. On the logs on my GA tests with molecule 6 I had in the logs:

Molecule default > dependency
  Starting galaxy role install process
  - staticdev.pyenv (2.10.2) is already installed, skipping.
  INFO     Dependency completed successfully.
  WARNING  Skipping, missing the requirements file.
...
Molecule default > converge
  
  PLAY [Converge] ****************************************************************
  
  TASK [Gathering Facts] *********************************************************
  ok: [instance]
  
  TASK [Update apt cache.] *******************************************************
  changed: [instance]
  
  TASK [Update pyOpenSSL.] *******************************************************
  changed: [instance]
  
  TASK [Include staticdev.python_developer] **************************************
  ERROR! the role 'staticdev.pyenv' was not found in ansible.legacy:/home/runner/work/ansible-role-python-developer/ansible-role-python-developer/staticdev.python_developer/molecule/default/roles:/home/runner/.cache/molecule/staticdev.python_developer/default/roles:/home/runner/work/ansible-role-python-developer/ansible-role-python-developer:/home/runner/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/home/runner/work/ansible-role-python-developer/ansible-role-python-developer:/home/runner/work/ansible-role-python-developer/ansible-role-python-developer/staticdev.python_developer/molecule/default
  
  The error appears to be in '/home/runner/work/ansible-role-python-developer/ansible-role-python-developer/staticdev.python_developer/meta/main.yml': line 37, column 5, but may
  be elsewhere in the file depending on the exact syntax problem.
  
  The offending line appears to be:
  
  dependencies:
    - name: staticdev.pyenv
      ^ here

I noticed on last major release of molecule it stopped installing it for some reason and I saw some changes related to dependencies such as ansible/molecule#3956. To continue with my role, I found a solution to not have a dependency at all, but I believe there could be a bug in molecule. It can be verified checking our my previous commit to this one staticdev/ansible-role-python-developer@65eb677#diff-92c74e80f0140aa012f39f58b4259dbe74401cdc9a0b84269295f480b9961809

@zhan9san
Copy link
Member

zhan9san commented Dec 3, 2023

@staticdev

There must be some misunderstand on https://github.com/ansible/molecule/pull/3956/files.

It is said the role-path and collection-path would be removed and they should be configured in ansible.cfg, which has no effect on role-file and requirements-file described in this doc, https://ansible.readthedocs.io/projects/molecule/configuration/#dependency

Here is what I tested.

$ cat molecule/default/molecule.yml
---
dependency:
  name: galaxy
  options:
    requirements-file: requirements.yml
$ cat requirements.yml
roles:
  - name: staticdev.pyenv
    version: 2.10.2

@staticdev
Copy link
Author

@staticdev

There must be some misunderstand on https://github.com/ansible/molecule/pull/3956/files.

It is said the role-path and collection-path would be removed and they should be configured in ansible.cfg, which has no effect on role-file and requirements-file described in this doc, https://ansible.readthedocs.io/projects/molecule/configuration/#dependency

Here is what I tested.

$ cat molecule/default/molecule.yml
---
dependency:
  name: galaxy
  options:
    requirements-file: requirements.yml
$ cat requirements.yml
roles:
  - name: staticdev.pyenv
    version: 2.10.2

This is exactly what I had for a long time in this repo and it always worked until August. I did no change on it's test config except the upgrades on external packages such as molecule. I don't have a clue why it broke.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants