ansible-lint icon indicating copy to clipboard operation
ansible-lint copied to clipboard

Ansible lint should check min_version from galaxy meta and warn of outdated values

Open ssbarnea opened this issue 3 years ago • 1 comments

Summary

This was requested as a feature in https://github.com/ansible/ansible-lint/discussions/1094#discussioncomment-127792 -- to be able to identify outdated or missing min_version in roles and collections.

The reality is that any core repository should expose which version of Ansible it needs for running and the linter should be able to remind us about documenting it.

Issue Type
  • Feature Idea
Additional Information

ssbarnea avatar Nov 12 '20 13:11 ssbarnea

While I do find this bug useful as I know many projects with invalid outdated values, I have no idea how to determine which value is outdated or not.

The linter requires ansible 2.9+ but this does not mean that the linter playbooks do not work with 2.8, or 2.7.

I am open to suggestions.

ssbarnea avatar Feb 20 '21 11:02 ssbarnea

I believe this got implemented, and it's making me unhappy :-)

I have ">=2.11" in the meta.yml file for one of my collections, because I know that it needs features which were added in 2.11. This is fine, it expresses my intent accurately.

The meta-runtime[unsupported-version] rule complains because 2.11 is apparently not a supported version now, but I'm not indicating that anything will actually be run using 2.11, just that something later than 2.10 is required. If the user of my collection elects to use it with 2.11 even though that version is unsupported that's not a problem for me or for the collection (it's potentially a problem for the user if they try to obtain support).

It is my opinion that having ">=2.11" is not in any way invalid; it correctly expresses the minimum required version of Ansible for this collection.

kpfleming avatar Feb 18 '23 12:02 kpfleming

@kpfleming Can you point me to a repo where you are facing this issue?

ssbarnea avatar Feb 18 '23 16:02 ssbarnea

Sure: https://github.com/kpfleming/ansible-powerdns-auth

kpfleming avatar Feb 18 '23 17:02 kpfleming

You'll have to remove that rule from the skip_list in .ansible-lint though.

kpfleming avatar Feb 18 '23 17:02 kpfleming

@kpfleming Have you tried to use >=2.11.0 instead of just >=2.11? It should work.

ssbarnea avatar Feb 20 '23 14:02 ssbarnea

I had not tried it, but you are correct. >=2.11.0 does not raise a warning in ansible-lint.

kpfleming avatar Feb 20 '23 14:02 kpfleming

Closing as done for now but I will reopen it if I see more people getting confused by the x.y.z requirement as we might need to change the error message to make it more clear which kind of values are accepted.

ssbarnea avatar Feb 20 '23 14:02 ssbarnea