Ansible-galaxy lint unexpected warnings

Hello,
I would ask an help for an error I can’t understand. I wrote my own collection. I checked it with ansible-lint and it didn’t return errors or warnings.
In the collection’s roles I write some CI tests in the form:

/<collection_name>/roles/<role_name>/test/test.yml

---
- name: Test role <rone_name>
  hosts: localhost
  roles:
    - <namespace>.<collection_name>.<role_name>

I use the FQCN notation in place of the deprecated collections: keyword, because ansible-lint tell me to work in this way.

This is working well in my CI environment, ansible-playbook works fine. As I said above, ansible-lint command passes all tests.

But when I try to publish the collection into my own Galaxy-NG server I see warnings like this:

[WARNING]: Galaxy import warning message: roles/<role_name>/tests/test.yml:44:7: syntax-check[specific]: the role '<namespace>.<collection_name>.<role_name>' was not found in
/tmp/tmppa432ngx/ansible_collections/<namespace>/<collection_name>/roles/<role_name>/tests/roles:/var/lib/pulp/.cache/ansible-compat/92a5dc/roles:/tmp/tmppa432ngx/ansible_collections/<namespace>/<collection_name>/roles:/var/lib/pulp/.ansible/roles:/usr/share
/ansible/roles:/etc/ansible/roles:/tmp/tmppa432ngx/ansible_collections/<namespace>/<collection_name>/roles/<role_name>/tests

I don’t understand why this happens. I believed that if ansible-lint succeeded, then the similar check in Galaxy would not have complained.

My question is: How do I can avoid these warnings? :disappointed_relieved:
These warnings only happen when I try to publish the collection in Galaxy-NG.


Ps: another warning that I see only during Galaxy import is

[ERROR]: Galaxy import error message: CHANGELOG.rst file not found at top level of collection.

I fix this error just creating the required files.

ansible-lint instead is satisfied with the file changelogs/changelog.yaml as described in official documentation.


My software versions are:

  • ansible-lint 24.2.0 using ansible-core:2.16.2 ansible-compat:4.1.11 ruamel-yaml:0.18.5 ruamel-yaml-clib:0.2.8
  • Galaxy-NG 4.6.3
  • Pulp Ansible 0.15.2

Thank you very much for every feedback and hints
Kind Regards
Marco

Hello,
I have updated my Galaxy-NG to the version 4.9.1 and the above warnings disappear.

Now I see new warnings during ansible-galaxy collection publish process which I can’t resolve:

[WARNING]: Galaxy import warning message: roles/<role name>/tasks/main.yml:9:3: syntax-check[specific]: couldn't resolve module/action 'community.general.ini_file'.
This often indicates a misspelling, missing collection, or incorrect module path.

In the develop environment ansible-lint doesn’t show this warning. My suspect was that on Galaxy-NG the community.general is not synced. So I synced the remote collection.
I have also added community.general as dependency in the galaxy.yml file of my own collection.

Then, I have deleted and published again my collection. The warning still shows.

My collection also use an external standalone role. Again, I don’t see problems by running a local ansible-lint, but when I publish the collection I see

[WARNING]: Galaxy import warning message: playbooks/myOS.yml:300:7: syntax-check[specific]: the role 'arillso.logrotate' was not found [...]

Tha playbook myOS.yml contains

  roles:
    - arillso.logrotate

I wonder how to avoid the above warnings. About missing collection, syncing them from remote is not sufficient.

Thank you for every hints
Kind Regards

Marco

The Galaxy importer does not installs any other collections except the one to import in its environment, and then runs various tools on it. This is also a problem for documentation extraction, see Galaxy importer: collection dependency handling.

Please cross post this to linter issue tracker. The fact that it does not detect missing chagelog is a bug. We aim to make linter enough to succeed publishing to galaxy.

The warning might be because of an older version of linter in galaxy uploader but needs to be checked.

Anyway, i will look into addressing these once we have bug filed. If needed we might have to raise a bug on galaxy importer but that is not sure yet.

Thank you for paying attention to this.
I filled a bug in ansible-lint now.
Please, ignore the CHANGELOG.rst file not found bug. I already verified that it happens only in Galaxy-NG 4.6.3, it has been fixed in 4.9.1.

We’re currently testing a newer version of ansible-lint to upgrade to in galaxy-importer dependencies, planning to move to 6.22.x.