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

ansible-lint is not consistent with Galaxy importer checks #4032

Open
falon opened this issue Feb 16, 2024 · 3 comments
Open

ansible-lint is not consistent with Galaxy importer checks #4032

falon opened this issue Feb 16, 2024 · 3 comments
Labels

Comments

@falon
Copy link

falon commented Feb 16, 2024

Summary

I run ansible-lint before publishing a collection into my Galaxy-NG.
Even if ansible-lint doesn't detect errors or warnings, the publish process shows warning about dependencies.

ansible-lint should warn me if Galaxy-NG has something else to claim.

Issue Type
  • Bug Report
OS / ENVIRONMENT
# ansible-lint --version
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 
Server version
    [4.9.1 ]
Pulp Ansible Version
    [0.20.3 ]
Pulp Container Version
    [2.15.4 ]
Pulp Core Version
    [3.28.23 ]
Galaxy Importer
    [0.4.20]
  • ansible installation method: pip
  • ansible-lint installation method: pip
STEPS TO REPRODUCE

Let suppose I developed a collection with a playbook that use an external role:
playbooks/myOS.yml:

[...]
roles:
    - arillso.logrotate

Also, let suppose the collection has dependecies in galaxy.yml:

[...]
dependencies:
   "community.general": ">=8.1.0"
   "community.docker": ">=3.4.11"

In my local environment I have installed all standalone roles and collections required.
Then:

# cd /path/to/collection
# ansible-lint
Passed: 0 failure(s), 0 warning(s) on 149 files. Last profile that met the validation criteria was 'production'.

# ansible-galaxy collection build

This is all fine. But when I try to publish on Galaxy-NG I see new unexpected warnings:

# ansible-galaxy collection publish --server myserver <collection_name>-1.0.0.tar.gz
[...]
[WARNING]: Galaxy import warning message: playbooks/myOS.yml:300:7: syntax-check[specific]: the role 'arillso.logrotate' was not found 
[WARNING]: Galaxy import warning message: roles/dnf_automatic_notifier/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.
[WARNING]: Galaxy import warning message: roles/hostnamectl/tasks/main.yml:4:3: syntax-check[specific]: couldn't resolve module/action 'community.docker.current_container_facts'. This often indicates a misspelling, missing collection, or incorrect module
path.
[WARNING]: Galaxy import warning message: roles/journald/tasks/main.yml:12:3: syntax-check[specific]: couldn't resolve module/action 'community.general.ini_file'. This often indicates a misspelling, missing collection, or incorrect module path.
[WARNING]: Galaxy import warning message: roles/rhsub/tasks/main.yml:14:3: syntax-check[specific]: couldn't resolve module/action 'community.general.redhat_subscription'. This often indicates a misspelling, missing collection, or incorrect module path.

I can't fix these warnings. I tried to sync remote required collections in Galaxy-NG, but it has no effect.

Desired Behavior
# ansible-galaxy collection publish --server myserver <collection_name>-1.0.0.tar.gz
Publishing collection artifact '/root/.ansible/collections/ansible_collections/...
Collection has been published to the Galaxy server ...
Waiting until Galaxy import task ... has completed
Collection has been successfully published and imported to the Galaxy server ...
Actual Behavior
Publishing collection artifact ...
Collection has been published to the Galaxy server ...
Waiting until Galaxy import task .... has completed
[WARNING]: Galaxy import warning message: playbooks/myOS.yml:300:7: syntax-check[specific]: the role 'arillso.logrotate' was not found in...
[WARNING]: Galaxy import warning message: roles/dnf_automatic_notifier/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.
[WARNING]: Galaxy import warning message: roles/hostnamectl/tasks/main.yml:4:3: syntax-check[specific]: couldn't resolve module/action 'community.docker.current_container_facts'. This often indicates a misspelling, missing collection, or incorrect module
path.
[WARNING]: Galaxy import warning message: roles/journald/tasks/main.yml:12:3: syntax-check[specific]: couldn't resolve module/action 'community.general.ini_file'. This often indicates a misspelling, missing collection, or incorrect module path.
[WARNING]: Galaxy import warning message: roles/rhsub/tasks/main.yml:14:3: syntax-check[specific]: couldn't resolve module/action 'community.general.redhat_subscription'. This often indicates a misspelling, missing collection, or incorrect module path.
Collection has been successfully published and imported to the Galaxy server ...

See also at the forum thread.

@falon falon added bug new Triage required labels Feb 16, 2024
@felixfontein
Copy link
Contributor

The Galaxy importer does not install dependencies before extracing docs or running ansible-lint. This causes a lot of errors/warnings that shouldn't be there.

Ref: https://forum.ansible.com/t/galaxy-importer-collection-dependency-handling/3496 (unfortunately there's no reaction from the Galaxy team...)

@ssbarnea ssbarnea removed the new Triage required label Feb 28, 2024
@ssbarnea
Copy link
Member

@alisonlhart Maybe you do know more about the subject? Clearly this does not seem as an issue with the linter itself.

@alisonlhart
Copy link
Contributor

@ssbarnea I wonder if this will be solved by upgrading the ansible-lint dependency. If not, IMO this is definitely something worth opening an issue for on galaxy-importer, especially when seeing the similar docs issue related to dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

4 participants