chore: bump distriution/reference dependency
We've made a new release https://github.com/distribution/reference Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
This commit is contained in:
parent
9d36624563
commit
167d7996be
6 changed files with 67 additions and 40 deletions
2
go.mod
2
go.mod
|
@ -11,7 +11,7 @@ require (
|
|||
github.com/aws/aws-sdk-go v1.48.10
|
||||
github.com/bshuster-repo/logrus-logstash-hook v1.0.0
|
||||
github.com/coreos/go-systemd/v22 v22.5.0
|
||||
github.com/distribution/reference v0.5.0
|
||||
github.com/distribution/reference v0.6.0
|
||||
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c
|
||||
github.com/docker/go-metrics v0.0.1
|
||||
github.com/go-jose/go-jose/v3 v3.0.3
|
||||
|
|
4
go.sum
4
go.sum
|
@ -63,8 +63,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
|
|||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
|
||||
github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0=
|
||||
github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
|
||||
github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
|
||||
github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
|
||||
github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI=
|
||||
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c h1:+pKlWGMw7gf6bQ+oDZB4KHQFypsfjYlq/C4rfL7D3g8=
|
||||
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA=
|
||||
|
|
2
vendor/github.com/distribution/reference/README.md
generated
vendored
2
vendor/github.com/distribution/reference/README.md
generated
vendored
|
@ -10,7 +10,7 @@ Go library to handle references to container images.
|
|||
[![codecov](https://codecov.io/gh/distribution/reference/branch/main/graph/badge.svg)](https://codecov.io/gh/distribution/reference)
|
||||
[![FOSSA Status](https://app.fossa.com/api/projects/custom%2B162%2Fgithub.com%2Fdistribution%2Freference.svg?type=shield)](https://app.fossa.com/projects/custom%2B162%2Fgithub.com%2Fdistribution%2Freference?ref=badge_shield)
|
||||
|
||||
This repository contains a library for handling refrences to container images held in container registries. Please see [godoc](https://pkg.go.dev/github.com/distribution/reference) for details.
|
||||
This repository contains a library for handling references to container images held in container registries. Please see [godoc](https://pkg.go.dev/github.com/distribution/reference) for details.
|
||||
|
||||
## Contribution
|
||||
|
||||
|
|
53
vendor/github.com/distribution/reference/normalize.go
generated
vendored
53
vendor/github.com/distribution/reference/normalize.go
generated
vendored
|
@ -123,20 +123,51 @@ func ParseDockerRef(ref string) (Named, error) {
|
|||
// splitDockerDomain splits a repository name to domain and remote-name.
|
||||
// If no valid domain is found, the default domain is used. Repository name
|
||||
// needs to be already validated before.
|
||||
func splitDockerDomain(name string) (domain, remainder string) {
|
||||
i := strings.IndexRune(name, '/')
|
||||
if i == -1 || (!strings.ContainsAny(name[:i], ".:") && name[:i] != localhost && strings.ToLower(name[:i]) == name[:i]) {
|
||||
domain, remainder = defaultDomain, name
|
||||
} else {
|
||||
domain, remainder = name[:i], name[i+1:]
|
||||
func splitDockerDomain(name string) (domain, remoteName string) {
|
||||
maybeDomain, maybeRemoteName, ok := strings.Cut(name, "/")
|
||||
if !ok {
|
||||
// Fast-path for single element ("familiar" names), such as "ubuntu"
|
||||
// or "ubuntu:latest". Familiar names must be handled separately, to
|
||||
// prevent them from being handled as "hostname:port".
|
||||
//
|
||||
// Canonicalize them as "docker.io/library/name[:tag]"
|
||||
|
||||
// FIXME(thaJeztah): account for bare "localhost" or "example.com" names, which SHOULD be considered a domain.
|
||||
return defaultDomain, officialRepoPrefix + name
|
||||
}
|
||||
if domain == legacyDefaultDomain {
|
||||
domain = defaultDomain
|
||||
|
||||
switch {
|
||||
case maybeDomain == localhost:
|
||||
// localhost is a reserved namespace and always considered a domain.
|
||||
domain, remoteName = maybeDomain, maybeRemoteName
|
||||
case maybeDomain == legacyDefaultDomain:
|
||||
// canonicalize the Docker Hub and legacy "Docker Index" domains.
|
||||
domain, remoteName = defaultDomain, maybeRemoteName
|
||||
case strings.ContainsAny(maybeDomain, ".:"):
|
||||
// Likely a domain or IP-address:
|
||||
//
|
||||
// - contains a "." (e.g., "example.com" or "127.0.0.1")
|
||||
// - contains a ":" (e.g., "example:5000", "::1", or "[::1]:5000")
|
||||
domain, remoteName = maybeDomain, maybeRemoteName
|
||||
case strings.ToLower(maybeDomain) != maybeDomain:
|
||||
// Uppercase namespaces are not allowed, so if the first element
|
||||
// is not lowercase, we assume it to be a domain-name.
|
||||
domain, remoteName = maybeDomain, maybeRemoteName
|
||||
default:
|
||||
// None of the above: it's not a domain, so use the default, and
|
||||
// use the name input the remote-name.
|
||||
domain, remoteName = defaultDomain, name
|
||||
}
|
||||
if domain == defaultDomain && !strings.ContainsRune(remainder, '/') {
|
||||
remainder = officialRepoPrefix + remainder
|
||||
|
||||
if domain == defaultDomain && !strings.ContainsRune(remoteName, '/') {
|
||||
// Canonicalize "familiar" names, but only on Docker Hub, not
|
||||
// on other domains:
|
||||
//
|
||||
// "docker.io/ubuntu[:tag]" => "docker.io/library/ubuntu[:tag]"
|
||||
remoteName = officialRepoPrefix + remoteName
|
||||
}
|
||||
return
|
||||
|
||||
return domain, remoteName
|
||||
}
|
||||
|
||||
// familiarizeName returns a shortened version of the name familiar
|
||||
|
|
44
vendor/github.com/distribution/reference/reference.go
generated
vendored
44
vendor/github.com/distribution/reference/reference.go
generated
vendored
|
@ -35,8 +35,13 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
// RepositoryNameTotalLengthMax is the maximum total number of characters in a repository name.
|
||||
RepositoryNameTotalLengthMax = 255
|
||||
|
||||
// NameTotalLengthMax is the maximum total number of characters in a repository name.
|
||||
NameTotalLengthMax = 255
|
||||
//
|
||||
// Deprecated: use [RepositoryNameTotalLengthMax] instead.
|
||||
NameTotalLengthMax = RepositoryNameTotalLengthMax
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -55,8 +60,8 @@ var (
|
|||
// ErrNameEmpty is returned for empty, invalid repository names.
|
||||
ErrNameEmpty = errors.New("repository name must have at least one component")
|
||||
|
||||
// ErrNameTooLong is returned when a repository name is longer than NameTotalLengthMax.
|
||||
ErrNameTooLong = fmt.Errorf("repository name must not be more than %v characters", NameTotalLengthMax)
|
||||
// ErrNameTooLong is returned when a repository name is longer than RepositoryNameTotalLengthMax.
|
||||
ErrNameTooLong = fmt.Errorf("repository name must not be more than %v characters", RepositoryNameTotalLengthMax)
|
||||
|
||||
// ErrNameNotCanonical is returned when a name is not canonical.
|
||||
ErrNameNotCanonical = errors.New("repository name must be canonical")
|
||||
|
@ -165,6 +170,9 @@ func Path(named Named) (name string) {
|
|||
return path
|
||||
}
|
||||
|
||||
// splitDomain splits a named reference into a hostname and path string.
|
||||
// If no valid hostname is found, the hostname is empty and the full value
|
||||
// is returned as name
|
||||
func splitDomain(name string) (string, string) {
|
||||
match := anchoredNameRegexp.FindStringSubmatch(name)
|
||||
if len(match) != 3 {
|
||||
|
@ -173,19 +181,6 @@ func splitDomain(name string) (string, string) {
|
|||
return match[1], match[2]
|
||||
}
|
||||
|
||||
// SplitHostname splits a named reference into a
|
||||
// hostname and name string. If no valid hostname is
|
||||
// found, the hostname is empty and the full value
|
||||
// is returned as name
|
||||
//
|
||||
// Deprecated: Use [Domain] or [Path].
|
||||
func SplitHostname(named Named) (string, string) {
|
||||
if r, ok := named.(namedRepository); ok {
|
||||
return r.Domain(), r.Path()
|
||||
}
|
||||
return splitDomain(named.Name())
|
||||
}
|
||||
|
||||
// Parse parses s and returns a syntactically valid Reference.
|
||||
// If an error was encountered it is returned, along with a nil Reference.
|
||||
func Parse(s string) (Reference, error) {
|
||||
|
@ -200,10 +195,6 @@ func Parse(s string) (Reference, error) {
|
|||
return nil, ErrReferenceInvalidFormat
|
||||
}
|
||||
|
||||
if len(matches[1]) > NameTotalLengthMax {
|
||||
return nil, ErrNameTooLong
|
||||
}
|
||||
|
||||
var repo repository
|
||||
|
||||
nameMatch := anchoredNameRegexp.FindStringSubmatch(matches[1])
|
||||
|
@ -215,6 +206,10 @@ func Parse(s string) (Reference, error) {
|
|||
repo.path = matches[1]
|
||||
}
|
||||
|
||||
if len(repo.path) > RepositoryNameTotalLengthMax {
|
||||
return nil, ErrNameTooLong
|
||||
}
|
||||
|
||||
ref := reference{
|
||||
namedRepository: repo,
|
||||
tag: matches[2],
|
||||
|
@ -253,14 +248,15 @@ func ParseNamed(s string) (Named, error) {
|
|||
// WithName returns a named object representing the given string. If the input
|
||||
// is invalid ErrReferenceInvalidFormat will be returned.
|
||||
func WithName(name string) (Named, error) {
|
||||
if len(name) > NameTotalLengthMax {
|
||||
return nil, ErrNameTooLong
|
||||
}
|
||||
|
||||
match := anchoredNameRegexp.FindStringSubmatch(name)
|
||||
if match == nil || len(match) != 3 {
|
||||
return nil, ErrReferenceInvalidFormat
|
||||
}
|
||||
|
||||
if len(match[2]) > RepositoryNameTotalLengthMax {
|
||||
return nil, ErrNameTooLong
|
||||
}
|
||||
|
||||
return repository{
|
||||
domain: match[1],
|
||||
path: match[2],
|
||||
|
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
|
@ -169,7 +169,7 @@ github.com/davecgh/go-spew/spew
|
|||
# github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f
|
||||
## explicit
|
||||
github.com/dgryski/go-rendezvous
|
||||
# github.com/distribution/reference v0.5.0
|
||||
# github.com/distribution/reference v0.6.0
|
||||
## explicit; go 1.20
|
||||
github.com/distribution/reference
|
||||
# github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c
|
||||
|
|
Loading…
Reference in a new issue