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

Role names should be able to begin with a underscore. #2035

Open
1 task done
gardar opened this issue Oct 18, 2024 · 9 comments
Open
1 task done

Role names should be able to begin with a underscore. #2035

gardar opened this issue Oct 18, 2024 · 9 comments
Labels
bug Something isn't working new_contributor This PR is the first contribution by a new community member.

Comments

@gardar
Copy link

gardar commented Oct 18, 2024

Summary

According to the Collection structure chapter of the docs:

Role names are now limited to contain only lowercase alphanumeric characters, plus _ and start with an alpha character.

However, I've observed that role names can start with an underscore _ character without causing any issues. I have tried this with Ansible versions 2.9, 2.10, 2.11, 2.12, 2.13, 2.14, 2,15, 2.16 and 2.17, and none of them had problems consuming a role with such a name. Ansible Galaxy also imports the role without any issues.

I understand that a role name like this might not be aesthetically pleasing, but there is a good reason for it. We recently added an Ansible role for common shared tasks to the [prometheus ansible collection](https://github.com/prometheus-community/ansible). The role is named _common (fqcn prometheus.prometheus._common) to distinguish it from the other roles in the collection, as it is an internal role that's only supposed to be used by the other roles and not directly by a user.

Related: ansible/ansible-lint#4370

Issue Type

Bug Report

Component Name

core

Ansible Version

N/A

Configuration

N/A

OS / Environment

N/A

Steps to Reproduce

N/A

Expected Results

N/A

Actual Results

N/A

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibot ansibot added bug Something isn't working needs_triage Needs a first human triage before being processed. labels Oct 18, 2024
@ansibot
Copy link
Contributor

ansibot commented Oct 18, 2024

Files identified in the description:

None

If these files are incorrect, please update the component name section of the description or use the component bot command.

@mattclay mattclay transferred this issue from ansible/ansible Oct 18, 2024
@ansible-documentation-bot ansible-documentation-bot bot added the new_contributor This PR is the first contribution by a new community member. label Oct 18, 2024
@ansible-documentation-bot
Copy link
Contributor

Thanks for your Ansible docs contribution! We talk about Ansible documentation on Matrix at #docs:ansible.im if you ever want to join us and chat about the docs! We meet on Matrix every Tuesday. See the Ansible calendar for meeting details. We welcome additions to our weekly agenda items too. You can add the dawgs-meeting tag to a forum topic to bring it up at the next meeting.

@samccann
Copy link
Contributor

Thanks @gardar - you bring up interesting points. Can you open a forum topic on this so it gets wider community discussion, and then add the link to that topic here?

@gardar
Copy link
Author

gardar commented Oct 22, 2024

Thanks @gardar - you bring up interesting points. Can you open a forum topic on this so it gets wider community discussion, and then add the link to that topic here?

Sure thing, opened a discussion here: https://forum.ansible.com/t/role-names-in-collections-should-be-able-to-begin-with-a-underscore/10454

@gardar
Copy link
Author

gardar commented Oct 22, 2024

Traced this down to the initial commit for the collection structure docs 49983fd, but I don't see any reasoning behind it. Perhaps this was an issue with the old galaxy and not valid anymore?

@s-hertel
Copy link
Contributor

@samccann If you need a decision by ansible-core, you could add it to our triage queue by adding the techreview label.

@samccann samccann added the techreview needs technical review label Oct 23, 2024
@samccann
Copy link
Contributor

Thanks @s-hertel ! added the label.
For core folks - we'd want approval that role names can begin with an underscore (either here in github land or over in the forum post). Thanks!

@nitzmahone
Copy link
Member

As the original author of a lot of the collections guts in core, I'm not aware of any technical limitations to underscore-prefixing any component of an FQCN. IIRC the first implementation used the same validation rules for all components out of sheer laziness on my part, which may have contributed to the origin of the rule.

I don't think we want to allow _ prefixed collection namespaces/names, but I personally have no objection to fully supporting _-prefixed collection resources at any level, as long as there are no associated runtime behavior expectations. The 1.x convention where a _ prefix was a transparent marker for deprecated modules was a bit of a nightmare to unwind, and caused a lot of performance and precedence problems during plugin resolution.

@nitzmahone
Copy link
Member

I don't think we want to allow _ prefixed collection namespaces/names

(and I realize I'm saying this not weeks after creating an internal core collection name starting with _ 🙄 )

@jborean93 jborean93 removed the needs_triage Needs a first human triage before being processed. label Nov 7, 2024
@s-hertel s-hertel removed the techreview needs technical review label Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working new_contributor This PR is the first contribution by a new community member.
Projects
Status: 🆕 Triage
Development

No branches or pull requests

6 participants