Skip to content

Conversation

analytically
Copy link
Contributor

@analytically analytically commented Mar 14, 2025

This change updates the identifier validation to permit identifiers that start with
numbers (e.g., "1pipeline") while keeping other validation rules intact. All identifiers
must now start with either a lowercase letter or a number, and the error messages have
been updated accordingly.

Release Note

  • Identifiers (names of pipelines/jobs/resources/steps/etc.) can start with numbers. Previously they could only start with a-z, otherwise Concourse would warn you that the identifier is invalid. An identifier cannot be only numbers though. 543 is invalid, but 2-days is valid.

@analytically analytically requested a review from a team as a code owner March 14, 2025 12:30
Copy link
Member

@taylorsilva taylorsilva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to identify time.Duration-like strings? It feels like we're trying to resolve a very specific pain here instead of trying to determine if there's a larger ask/pain here.

Also, instead of rolling our own regex, why not use time.ParseDuration()?

After looking up where identifier gets used I'm guessing you have resources whose names are time.Duration-like strings?

Back to the larger ask, because I don't want this file to be committed full of exceptions for strings that look like X, then Y, then Z, etc.

Do we want to allow identifiers that start with numbers?
Having context for why we have our current limitation would be helpful to answer this question. Let's go explore the project history.

I looked through the commit history for this file, specifically looking at the lines where the regex are defined.
I looked at this commit e6c2ede.
Then the PR it came from: #5864
Ah, that PR references an RFC: concourse/rfcs#40
And the original motivation(s): #3985

So taking in all this context, it looks like identifier restrictions were introduced to ensure folks don't put weird characters in places that appear in URL's.

I'm not seeing any great reason to not allow identifiers to start with numbers, though it also seems like no one is really asking for that. That's always dangerous with yaml too because a bunch of numbers are going to be parsed as a number instead of a string.

a_number: 123
a_string: "123"

Though I don't think anyone would name a pipeline/job/resource/task step JUST numbers.

I think it's reasonable to want to allow identifiers to start with numbers, given the one example here of having a time resource that you want to name 1h.

Would it break anything on the CLI level?

fly -t ci set-pipeline -p 1-pipeline-name

Pipeline names look weird, but I don't think this will break anything at the CLI level.

At the URL level this would be totally fine too. Having numbers at the start of any part of a URL path isn't breaking anything at the browser level or making anything harder for us to do within the web frontend, is it?

Do we want to allow an identifier to be ONLY numbers? A pipeline, job, or resource that's only numbers feels very strange and now I kinda worry it might break something...

I would be fine with allowing the identifier to start with numbers, but let's not allow the identifier to be only numbers. I think that would be a good middle ground here. What do you think?

@analytically
Copy link
Contributor Author

analytically commented Mar 18, 2025

I would be fine with allowing the identifier to start with numbers, but let's not allow the identifier to be only numbers. I think that would be a good middle ground here. What do you think?

Agreed. I'll change the PR.

@analytically analytically changed the title feat: enhance identifier validation (warnings) to not warn for time formats chore: allow identifiers to start with numbers Mar 18, 2025
This change updates the identifier validation to permit identifiers that start with
numbers (e.g., "1pipeline") while keeping other validation rules intact. All identifiers
must now start with either a lowercase letter or a number, and the error messages have
been updated accordingly.

Signed-off-by: Mathias Bogaert <mathias.bogaert@gmail.com>
@taylorsilva
Copy link
Member

@taylorsilva taylorsilva moved this to Todo in Pull Requests Apr 30, 2025
@taylorsilva taylorsilva moved this from Todo to In Progress in Pull Requests Apr 30, 2025
Signed-off-by: Taylor Silva <dev@taydev.net>
@taylorsilva taylorsilva changed the title chore: allow identifiers to start with numbers atc: allow identifiers to start with numbers Apr 30, 2025
@taylorsilva taylorsilva merged commit 4a13399 into concourse:master Apr 30, 2025
12 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Pull Requests Apr 30, 2025
@analytically analytically deleted the idverif branch April 30, 2025 22:33
taylorsilva added a commit to concourse/docs that referenced this pull request May 1, 2025
After concourse/concourse#9119 is released,
identifiers can start with numbers, not just letters

Signed-off-by: Taylor Silva <dev@taydev.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants