Component Name Grammar Aligned with OCI
Goal
Align the component-name grammar with the one real constraint, the OCI repository path grammar, so a name maps directly to the OCI repository path <subPath>/component-descriptors/<name>. This is grammar compatibility. The name itself is limited to 255 characters. Registries and clients apply their own length limits to the full path. Registries based on distribution limit the repository path without the host to 255 characters. Many clients limit the host (with optional port), the / separator, and the repository path together to 255 characters, as the OCI distribution specification notes. The component-descriptors/ prefix (22 characters) and any subPath therefore reduce the usable name length, and for such clients the registry host does too. A name that is valid on its own may still be rejected when the full path is too long; the grammar does not check this.
What Changed
The componentName pattern in the descriptor v2 and constructor v1 schemas, and compref.ComponentRegex, moved from:
^[a-z][-a-z0-9]*([.][a-z][-a-z0-9]*)*[.][a-z]{2,}(/[a-z][-a-z0-9_]*([.][a-z][-a-z0-9_]*)*)+$to:
^[a-z0-9]([-a-z0-9]*[a-z0-9])?([.][a-z0-9]([-a-z0-9]*[a-z0-9])?)*[.][a-z]{2,}(/[a-z0-9]+(([.]|_|__|-+)[a-z0-9]+)*)+$- Relaxed: the letter-first rule is dropped. DNS labels and path segments may start with a digit, and path segments may consist only of digits (
1password.com/cli,acme.org/1,acme.org/1foo,acme.org/v1/2). - Tightened: names that are invalid in OCI are rejected at validation time instead of failing later at the store (
acme.org/foo-,acme.org/foo_,acme.org/a_-b,acme.org/a___b,acme-.org/x). - Reserved: the
component-descriptorssegment is reserved for the storage mapping and is rejected in a name.
Lowercase-only is unchanged. Uppercase would need a new name mapping and is out of scope.
Compatibility with Legacy OCM (v1)
- Tightening OCI-invalid names is compatible under the
urlPathmapping:urlPathis the only mapping the new tooling implements, and under it the names rejected here (acme.org/foo-,acme.org/a___b,acme-.org/x, …) could never be stored, so no working name is lost. Legacy OCM (v1) also offered a deprecatedsha256-digestmapping that hashes the name into the repository path and could store such names; a component published only that way is no longer accepted by the new grammar, so audit for these names and rename them before you migrate. - Reserving
component-descriptorsis a narrow exception: a name such asacme.org/component-descriptorsis a valid OCI path and passed the old grammar, but it collides with the storage prefix and is now rejected. Referencing such a name was already unreliable, because the reference parser splits on the lastcomponent-descriptorssegment. If you published one, rename the component before you upgrade. - Dropping the letter-first rule is not compatible: legacy OCM (v1) rejects digit-led names such as
acme.org/1. Digit-led and digit-only names are readable only by legacy tooling fromv0.57.0, which relaxes the letter-first rule in its embedded schemas.
Minimum legacy OCM (v1) version that reads digit-led component names: v0.57.0 (see open-component-model/ocm#2186). The prerelease v0.57.0-rc.1 reads them too. v0.56.0 and older reject such names with a schema validation error.
Action Required
If you used the default urlPath mapping, names that already work keep working, except a name containing a component-descriptors segment (see the reserved-segment note above), which is now rejected and must be renamed. If you used the deprecated sha256-digest mapping, audit for names the new grammar rejects (trailing or doubled separators, uppercase, or a component-descriptors segment) and rename them before migrating. If you adopt a digit-led or digit-only name, make sure every consumer still on legacy OCM (v1) is at least the minimum version above before you publish it.