opencontainers / distribution-spec

OCI Distribution Specification
https://opencontainers.org
Apache License 2.0
828 stars 205 forks source link

Define the representation for a tag name. #256

Closed briandealwis closed 3 years ago

briandealwis commented 3 years ago

A tag is defined in the spec as a manifest identifier, but the spec does not define the acceptable representations for a tag. This PR provides a definition for the tag name based on the historical description from docker tag.

There was no reference to definitions for regular expressions, and other examples used basic regexs, so I didn't use character classes or bounds limits.

Motivated by #52

jonjohnsonjr commented 3 years ago

We might want to be a little more explicit around what the audience of the limitation. Clients need to know the allowed character set and maximum safe length for tags. Registries need to know the minimum length they need to support.

Clients: (1,128]

Registries: [128,Inf)

So... in order for clients to be able to use at most 128 characters, registries should support at least 128 characters.

We could also sidestep some of these questions with something like:

Throughout this document, `<reference>` must match the [grammar for digests](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md#digests) or the following regular expression for tags:

`[\w][\w.-]{0,127}`
briandealwis commented 3 years ago

Oops sorry: these comments ended up in my hidden in my personal email.

@jonjohnsonjr I'm a bit hesitant:

jonjohnsonjr commented 3 years ago

seems to imply that a registry must support tags that have a minimum of 128 characters?

If registries don't support at least 128 characters in a tag, then they will be "broken" from the perspective of a client that expects to be able to use up to 128 characters.

It's basically Postel's Law: clients need to be conservative in what they do, and registries should be liberal in what they accept.

Is that a good idea? Who knows. The bare minimum, IMO, is that registries should support up to 128 characters. Given that clients are probably not prepared to deal with tags longer than 128 characters, maybe registries should also not support longer tags than that, but it seems a little bit limiting...

jonjohnsonjr commented 3 years ago

LGTM but I'm not a maintainer :)

vbatts commented 3 years ago

@briandealwis your commit are missing DCO signature

briandealwis commented 3 years ago

Added a sign-off.

briandealwis commented 3 years ago

Approval required by 1 of: @caniszczyk, @crosbymichael, @dmcgowan, @jdolitsky, @jzelinskie, @mikebrow, @stevvooe