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

changelog check does not follow ansible defined best practice for YAML extensions; resulting in undetected changelogs.

Open r-pufky opened this issue 10 months ago • 2 comments

Summary

Ansible best practice defines YAML files to be specified with a yml extension. ansible-galaxy init also ENFORCES this behavior when templating collections and roles; the use of .yaml is accepted throughout documentation as valid but .yml is always preferred in all of their use cases, examples, and documentation.

Some relevant docs (many more):

  1. https://docs.ansible.com/ansible/latest/galaxy/user_guide.html
  2. https://docs.ansible.com/ansible/latest/community/collection_development_process.html#creating-a-changelog-fragment
  3. https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_reuse_roles.html#role-directory-structure
  4. https://docs.ansible.com/ansible/latest/dev_guide/developing_modules_documenting.html
  5. https://github.com/ansible-community/antsibull-changelog/blob/main/docs/changelog.yaml-format.md
Issue Type
  • Bug Report
OS / ENVIRONMENT
$ ansible-lint --version
ansible-lint 24.2.2 using ansible-core:2.16.5 ansible-compat:4.1.11 ruamel-yaml:0.18.6 ruamel-yaml-clib:0.2.8
(ansible) 
  • ansible installation method: pip
  • ansible-lint installation method: pip
STEPS TO REPRODUCE

Place changelog files in the following locations and run ansible-lint:

 file location                        | ansible-lint | interpretation
--------------------------------------|--------------|----------------
 collection/changelog.yaml            | no detect    | correct.
 collection/CHANGELOG.yaml            | no detect    | correct.
 collection/CHANGELOG.yml             | no detect    | correct.
 collection/changelog.yml             | no detect    | correct.
 collection/CHANGELOG.md              | detect       | correct.
 collection/changelog.md              | no detect    | correct.
 collection/CHANGELOG.rst             | detect       | correct.
 collection/changelog.rst             | no detect    | correct.
 collection/changelogs/changelog.yaml | detect       | correct.
 collection/changelogs/CHANGELOG.yaml | no detect    | correct.
 collection/changelogs/CHANGELOG.yml  | no detect    | correct.
 collection/changelogs/changelog.yml  | no detect    | incorrect: accept '.yml'.
 collection/changelogs/CHANGELOG.md   | no detect    | correct.
 collection/changelogs/changelog.md   | no detect    | correct.
 collection/changelogs/CHANGELOG.rst  | no detect    | correct.
 collection/changelogs/changelog.rst  | no detect    | correct.
Desired Behavior

ansible-lint should honor accepted best practices from ansible themselves, and ether:

  1. Enforce .yml extension over .yaml.
  2. Allow both .yml and .yaml extensions as valid YAML files.

It should be noted that lint enforces .yml extensions for other lints; such as galaxy[no-runtime] rule:

galaxy[no-runtime]: meta/runtime.yml file not found.
galaxy.yml:1
Actual Behavior

.yml changelog files are explicitly failed to be detected. Additionally capped naming conventions for important user consumer documentation are not followed.

r-pufky avatar Apr 10 '24 19:04 r-pufky

A PR to address this will be more than welcomed.

ssbarnea avatar Apr 16 '24 09:04 ssbarnea

If there was a PR to address this, and it was merged, I presume we would also want to make a PR within the galaxy-importer repository? Basing this on the work done here, https://github.com/ansible/ansible-lint/pull/2832. @ssbarnea

cavcrosby avatar May 15 '24 14:05 cavcrosby