Merge pull request #5681 from kzys/info-url

remotes/docker: log registry URLs as info instead of debug
This commit is contained in:
Fu Wei 2022-04-20 14:21:15 +08:00 committed by GitHub
commit 9b33526ef6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,18 +52,17 @@ func (r dockerFetcher) Fetch(ctx context.Context, desc ocispec.Descriptor) (io.R
return newHTTPReadSeeker(desc.Size, func(offset int64) (io.ReadCloser, error) { return newHTTPReadSeeker(desc.Size, func(offset int64) (io.ReadCloser, error) {
// firstly try fetch via external urls // firstly try fetch via external urls
for _, us := range desc.URLs { for _, us := range desc.URLs {
ctx = log.WithLogger(ctx, log.G(ctx).WithField("url", us))
u, err := url.Parse(us) u, err := url.Parse(us)
if err != nil { if err != nil {
log.G(ctx).WithError(err).Debug("failed to parse") log.G(ctx).WithError(err).Debugf("failed to parse %q", us)
continue continue
} }
if u.Scheme != "http" && u.Scheme != "https" { if u.Scheme != "http" && u.Scheme != "https" {
log.G(ctx).Debug("non-http(s) alternative url is unsupported") log.G(ctx).Debug("non-http(s) alternative url is unsupported")
continue continue
} }
log.G(ctx).Debug("trying alternative url") ctx = log.WithLogger(ctx, log.G(ctx).WithField("url", u))
log.G(ctx).Info("request")
// Try this first, parse it // Try this first, parse it
host := RegistryHost{ host := RegistryHost{