summaryrefslogtreecommitdiff
path: root/pkg/registries
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2020-06-16 14:06:55 +0200
committerValentin Rothberg <rothberg@redhat.com>2020-07-15 11:42:04 +0200
commit660208cea38fdebb302f674b40bfd755f02def2d (patch)
tree4acfcbf240b01297adeb9f90b381c5e11d52c5de /pkg/registries
parent7f8643a7820cb5bf3e8e196e31b1fa558b3a2a18 (diff)
downloadpodman-660208cea38fdebb302f674b40bfd755f02def2d.tar.gz
podman-660208cea38fdebb302f674b40bfd755f02def2d.tar.bz2
podman-660208cea38fdebb302f674b40bfd755f02def2d.zip
search: allow wildcards
Allow wildcards in the search term. Note that not all registries support wildcards and it may only work with v1 registries. Note that searching implies figuring out if the specified search term includes a registry. If there's not registry detected, the search term will be used against all configured "unqualified-serach-registries" in the registries.conf. The parsing logic considers a registry to be the substring before the first slash `/`. With these changes we now not only support wildcards but arbitrary input; ultimately it's up to the registries to decide whether they support given input or not. Fixes: bugzilla.redhat.com/show_bug.cgi?id=1846629 Cherry-pick-of: commit b05888a97dbb Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'pkg/registries')
-rw-r--r--pkg/registries/registries.go16
1 files changed, 0 insertions, 16 deletions
diff --git a/pkg/registries/registries.go b/pkg/registries/registries.go
index 927e7a62a..ab7accd5e 100644
--- a/pkg/registries/registries.go
+++ b/pkg/registries/registries.go
@@ -3,12 +3,10 @@ package registries
import (
"os"
"path/filepath"
- "strings"
"github.com/containers/image/v5/pkg/sysregistriesv2"
"github.com/containers/image/v5/types"
"github.com/containers/libpod/v2/pkg/rootless"
- "github.com/docker/distribution/reference"
"github.com/pkg/errors"
)
@@ -77,17 +75,3 @@ func GetInsecureRegistries() ([]string, error) {
}
return insecureRegistries, nil
}
-
-// GetRegistry returns the registry name from a string if specified
-func GetRegistry(image string) (string, error) {
- // It is possible to only have the registry name in the format "myregistry/"
- // if so, just trim the "/" from the end and return the registry name
- if strings.HasSuffix(image, "/") {
- return strings.TrimSuffix(image, "/"), nil
- }
- imgRef, err := reference.Parse(image)
- if err != nil {
- return "", err
- }
- return reference.Domain(imgRef.(reference.Named)), nil
-}