Skip to content

Variable name validation restrictions - underscores only? #17865

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

Closed
lelouvincx opened this issue Apr 19, 2025 · 3 comments · Fixed by #17995
Closed

Variable name validation restrictions - underscores only? #17865

lelouvincx opened this issue Apr 19, 2025 · 3 comments · Fixed by #17995

Comments

@lelouvincx
Copy link
Contributor

lelouvincx commented Apr 19, 2025

Background

I'm currently working on upgrading from the deprecated String blocks to the newer Variable objects as part of preparation for the June 2025 deprecation deadline (don't remember exactly, but I have an impression that I've read somewhere). However, I've hit a roadblock with variable naming conventions.

The Issue

When trying to register a block with a variable name that contains hyphens, I'm receiving this validation error:

Failed to register GCP secrets for ci: 1 validation error for `VariableCreate` name.
Value error: Variable names must only contain lowercase letters, numbers, and underscores.

The specific variable name that's failing is "gcp-cred" because it contains a hyphen (-).

Question

Is there a specific technical reason or design principle behind restricting Variable names to only lowercase letters, numbers, and underscores?

This seems more restrictive than many other systems that commonly allow hyphens in identifiers. Since I need to migrate several blocks that use hyphenated naming conventions, understanding the reasoning would help me plan my migration approach better.

Also, if this is an intentional restriction, it might be helpful to have this more explicitly documented in the migration guides for those of us moving from String blocks (which presumably allowed hyphens) to Variables.

Thanks for any insights!

@lelouvincx
Copy link
Contributor Author

Hello @aaazzam and @cicdw , is there any context on this?

@zzstoatzz
Copy link
Collaborator

hi @lelouvincx - thanks for the issue! there was a historical reason for doing this, but at this point I don't think there's a strong reason remaining. we will allow hyphenated variable names

@lelouvincx
Copy link
Contributor Author

Thanks @zzstoatzz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants