Skip to content

Commit 54fba0c

Browse files
committed
identifiers rev 1.1: allow underscore
concourse/concourse#6070 Signed-off-by: Alex Suraci <[email protected]>
1 parent 170c171 commit 54fba0c

File tree

1 file changed

+41
-31
lines changed

1 file changed

+41
-31
lines changed

040-valid-identifiers/proposal.md

+41-31
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
* Revision: [1.1](#revision-1.1)
12
* RFC PR: [concourse/rfcs#40](https://github.com/concourse/rfcs/pull/40)
23
* Concourse Issue: [concourse/concourse#5810](https://github.com/concourse/concourse/issues/5810)
34

@@ -28,22 +29,24 @@ CLI uses `PIPELINE/JOB` notation for flags specifying a job, but this would be
2829
ambiguous if your pipeline or job names allowed `/` in their name. For example,
2930
`foo/bar/baz` could either be (`foo/bar`, `baz`) or (`foo`, `bar/baz`).
3031

31-
Allowing whitespace, capitalization, and mixed use of `_` and `-` also results
32-
in inconsistent naming conventions between Concourse users. A 'deploy to prod'
33-
job may be called any of the following:
32+
Allowing whitespace and capitalization along with `_` and `-` results in
33+
inconsistent naming conventions between Concourse users. A 'deploy to prod' job
34+
may be called any of the following:
3435

36+
* `prod-deploy`
3537
* `deploy to prod`
3638
* `deploy-to-prod`
3739
* `deploy_to_prod`
3840
* `Deploy to prod`
41+
* `deploy to Prod`
3942
* `Deploy to Prod`
4043

41-
This variance is largely cosmetic and makes it difficult for a new Concourse
42-
user on an existing team to predict the name of a given job.
43-
4444
Permitting so many different naming conventions makes the Concourse UX, which
4545
is largely text-based, feel inconsistent between different projects with
46-
different naming conventions.
46+
different naming conventions. This inconsistency may seem insignficant to users
47+
who only use Concourse within a single team, but it will become more pronounced
48+
if/when the Concourse project introduces a central place to share re-usable
49+
pipeline templates and other configuration.
4750

4851
Allowing spaces also makes it awkward to pass identifiers to the `fly` CLI, as
4952
they would have to be explicitly quoted so they're not parsed as separate
@@ -60,17 +63,18 @@ reduce the allowed character set for Concourse identifiers.
6063

6164
The following characters will be permitted:
6265

63-
* Unicode letters.
66+
* Non-uppercase Unicode letters (i.e. lowercase or letter with no uppercase).
6467
* Decimal numbers.
65-
* Hyphens (`-`), as the canonical word separator.
68+
* Hyphens (`-`) and underscores (`_`), as the canonical word separators.
6669
* Periods (`.`), in order to support domain names and version numbers.
6770

68-
All letters will be converted to lowercase. This is to enforce
69-
case-insensitivity and to present a consistent UI/UX while still supporting
70-
languages that don't have any casing (e.g. Japanese).
71-
72-
Notably, the underscore character (`_`) is forbidden. This is to further
73-
enforce consistency in word separators.
71+
It's worth noting that both hyphens (`-`) and underscores (`_`) are allowed as
72+
word separators. While this may lead to the kind of fragmentation this proposal
73+
aims to prevent, allowing both is more pragmatic than forbidding either: `-` is
74+
already commonplace, while `_` is more consistent with config params like
75+
`resource_types` and is commonly used with other tools and naming conventions
76+
(e.g. `x86_64`). The first iteration of this proposal did not allow the use of
77+
underscore; see [Revision 1.1](#revision-1.1) for details.
7478

7579
All identifiers must start with a valid letter. Allowing digits or symbols at
7680
the beginning would allow for a few confusing situations:
@@ -86,30 +90,22 @@ With Go's [`re2`](https://github.com/google/re2/wiki/Syntax) syntax, a valid
8690
identifier would be matched by the following regular expression:
8791

8892
```re
89-
^\p{L}[\p{L}\d\-.]*$
93+
^[\p{Ll}\p{Lt}\p{Lm}\p{Lo}][\p{Ll}\p{Lt}\p{Lm}\p{Lo}\d\-.]*$
9094
```
9195
92-
This scheme is very similar to the [restrictions on valid
93-
hostnames][valid-hostnames], with the exception that any Unicode letter is
94-
allowed instead of `a-z`. This similarity is incidental, but it's a convenient
95-
comparison to draw as hostnames and Concourse identifiers have similar needs:
96-
to be used in URLs, to be referenced from the commandline (`fly`), to be
97-
referenced in configuration (pipelines), and to be case-insensitive.
98-
9996
## Renaming existing data
10097
101-
The following API resources can already be renamed manually:
98+
All API resources can already be renamed manually:
10299
103100
* Pipelines can be renamed with `fly rename-pipeline`.
104101
* Teams can be renamed with `fly rename-team`.
105102
* Jobs can be renamed by updating their `name` and specifying the old name as
106-
[`old_name:`](https://concourse-ci.org/jobs.html#job-old-name). This will
107-
preserve their build history.
103+
[`old_name`][jobs-old-name]. This will preserve the job's build history.
104+
* Resources can be renamed in the same fashion by setting
105+
[`old_name`][resources-old-name]. This will preserve the resource's state
106+
(i.e. disabled versions, pinning).
108107
* Step names can be renamed without any migration necessary.
109108
110-
Resources cannot currently be renamed; support for doing so will need to be
111-
implemented before enforcing resource identifier validation.
112-
113109
## Easing the transition
114110
115111
Enforcing rules about identifiers is easy. Doing this in a way that doesn't
@@ -121,7 +117,9 @@ interact with mission-critical pipelines that have now-invalid identifiers
121117
would be a major problem. Users should not be punished for upgrading.
122118
123119
To ease this pain, we can allow existing data to stay as-is, and only enforce
124-
the identifier rules for newly created teams and pipelines.
120+
the identifier rules for newly created teams and pipelines. Additionally,
121+
these validations can be implemented as warnings for a long period of time so
122+
that users have time to adapt.
125123
126124
Existing data will still be fully functional and writable (i.e. updated with
127125
`fly set-pipeline`, `fly set-team`), and Concourse can emit warnings for any
@@ -172,5 +170,17 @@ n/a
172170
173171
* n/a
174172
173+
174+
# Revisions
175+
176+
## Revision 1.1
177+
178+
In response to feedback in [concourse/concourse#6070][underscores-issue] this
179+
RFC has been amended to allow the use of the underscore character (`_`) in
180+
identifiers.
181+
182+
175183
[var-sources-rfc]: https://github.com/concourse/rfcs/pull/39
176-
[valid-hostnames]: https://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_hostnames
184+
[underscores-issue]: https://github.com/concourse/concourse/issues/6070
185+
[jobs-old-name]: https://concourse-ci.org/jobs.html#schema.job.old_name
186+
[resources-old-name]: https://concourse-ci.org/resources.html#schema.resource.old_name

0 commit comments

Comments
 (0)