-
Notifications
You must be signed in to change notification settings - Fork 705
Description
Summary
ansible-lint
raises an error with "very high" severity if galaxy.yml
doesn't have a repository
key.
As Collection Galaxy metadata structure says, repository
key is not required. Thus ansible-lint
should not detect schema[galaxy]
rule violation, which is mandatory. It can raise galaxy[xxx]
rule with less severity.
Issue Type
- Bug Report
OS / ENVIRONMENT
ansible-lint --version
# ansible-lint 25.9.0 using ansible-core:2.19.2 ansible-compat:25.8.1 ruamel-yaml:0.18.15 ruamel-yaml-clib:0.2.14
- OS: Fedora release 42 (Adams)
- ansible installation method: one of source, pip
- ansible-lint installation method: one of source, pip
STEPS TO REPRODUCE
- Create
galaxy.yml
as below.
namespace: local
name: test
description: ''
version: 0.0.1
readme: README.md
authors:
- nobody
- Validate the
galaxy.yml
withansible-lint
.
ansible-lint galaxy.yml
python3 -m venv venv
source venv/bin/activate
pip install ansible-core ansible-lint
cat << 'EOF' > galaxy.yml
namespace: local
name: test
description: ''
version: 0.0.1
readme: README.md
authors:
- nobody
EOF
ansible-lint galaxy.yml
Desired Behavior
ansible-lint
should not report schema[galaxy]
because galaxy.yml
provided above is syntactically correct.
Actual Behavior
ansible-lint galaxy.yml
reported schema[galaxy]
rule violation.
ansible-lint galaxy.yml
# WARNING Project directory /.ansible cannot be used for caching as it is not writable.
# WARNING Using unique temporary directory /tmp/.ansible-0aaa for caching.
# WARNING Listing 5 violation(s) that are fatal
# galaxy[no-changelog]: No changelog found. Please add a changelog file. Refer to the galaxy.md file for more info.
# galaxy.yml:1
# galaxy[tags]: galaxy.yaml must have one of the required tags: ['application', 'cloud', 'database', 'eda', 'infrastructure', 'linux', 'monitoring', 'networking', 'security', 'storage', 'tools', 'windows']
# galaxy.yml:1
# galaxy[no-runtime]: meta/runtime.yml file not found.
# galaxy.yml:1
# schema[galaxy]: $ 'repository' is a required property. See https://docs.ansible.com/ansible/latest/dev_guide/collections_galaxy_meta.html
# galaxy.yml:1 Returned errors will not include exact line numbers, but they will mention
# the schema name being used as a tag, like ``schema[playbook]``,
# ``schema[tasks]``.
# This rule is not skippable and stops further processing of the file.
# If incorrect schema was picked, you might want to either:
# * move the file to standard location, so its file is detected correctly.
# * use ``kinds:`` option in linter config to help it pick correct file type.
# [/]
# yaml[empty-lines]: Too many blank lines (1 > 0)
# galaxy.yml:10
# Read documentation for instructions on how to ignore specific rule violations.
# # Rule Violation Summary
# 1 schema profile:basic tags:core
# 1 yaml profile:basic tags:formatting,yaml
# 1 galaxy profile:basic tags:metadata
# 1 galaxy profile:basic tags:metadata
# 1 galaxy profile:basic tags:metadata
# Failed: 5 failure(s), 0 warning(s) in 1 files processed of 1 encountered. Last profile that met the validation criteria was 'min'.
Impact on VS Code Ansible Extension
VS Code Ansible Extension raises Missing property "repository".
error. This might look outstanding to Ansible extension users.

YAML schema validation errors has high severity [1]
and is mandatory [2]
, which I guess is why the error appears on the VS Code.
[1]
schema rule is mandatory.[2]
severity
isVERY HIGH
in schema.py
Proposal
repository
key should be removed fromrequired
list in the schema galaxy.json.- I know
repository
key andlicense
key are required ingalaxy.yml
to push to Ansible Galaxy. Thus we can add some rules to galaxy.py and galaxy.md such asgalaxy[no-repository]
andgalaxy[no-license]
in order to let developers write a better code.
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
No status