mirror of
https://github.com/genuinetools/reg.git
synced 2024-05-09 16:28:32 -04:00
fix getting official registry manifest
closes #164 Signed-off-by: Jess Frazelle <acidburn@github.com>
This commit is contained in:
parent
32589e90be
commit
067711f90e
2
main.go
2
main.go
|
@ -119,6 +119,8 @@ func createRegistryClient(ctx context.Context, domain string) (*registry.Registr
|
|||
}
|
||||
|
||||
// Create the registry client.
|
||||
logrus.Infof("domain: %s", domain)
|
||||
logrus.Infof("server address: %s", auth.ServerAddress)
|
||||
return registry.New(ctx, auth, registry.Opt{
|
||||
Domain: domain,
|
||||
Insecure: insecure,
|
||||
|
|
|
@ -29,3 +29,16 @@ func TestManifestV1(t *testing.T) {
|
|||
t.Fatalf("expected: %s\ngot: %s", expected, out)
|
||||
}
|
||||
}
|
||||
|
||||
func TestManifestWithHubDomain(t *testing.T) {
|
||||
// Regression test for https://github.com/genuinetools/reg/issues/164
|
||||
out, err := run("manifest", "busybox")
|
||||
if err != nil {
|
||||
t.Fatalf("output: %s, error: %v", out, err)
|
||||
}
|
||||
|
||||
expected := `"schemaVersion": 2,`
|
||||
if !strings.Contains(out, expected) {
|
||||
t.Fatalf("expected: %s\ngot: %s", expected, out)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ func New(ctx context.Context, auth types.AuthConfig, opt Opt) (*Registry, error)
|
|||
}
|
||||
|
||||
func newFromTransport(ctx context.Context, auth types.AuthConfig, transport http.RoundTripper, opt Opt) (*Registry, error) {
|
||||
if len(opt.Domain) < 1 {
|
||||
if len(opt.Domain) < 1 || opt.Domain == "docker.io" {
|
||||
opt.Domain = auth.ServerAddress
|
||||
}
|
||||
url := strings.TrimSuffix(opt.Domain, "/")
|
||||
|
|
Loading…
Reference in a new issue