ansible-lint
ansible-lint copied to clipboard
changelog check does not follow ansible defined best practice for YAML extensions; resulting in undetected changelogs.
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):
- https://docs.ansible.com/ansible/latest/galaxy/user_guide.html
- https://docs.ansible.com/ansible/latest/community/collection_development_process.html#creating-a-changelog-fragment
- https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_reuse_roles.html#role-directory-structure
- https://docs.ansible.com/ansible/latest/dev_guide/developing_modules_documenting.html
- 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:
- Enforce
.yml
extension over.yaml
. - 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.
A PR to address this will be more than welcomed.
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