Unverified Commit 560eba7b authored by Wenkai Yin(尹文开)'s avatar Wenkai Yin(尹文开) Committed by GitHub
Browse files

Merge pull request #12894 from stonezdj/200827_dockerhub_offline

 Fallback to local repo on errors when proxy to remote repo
parents fb23db39 6967d734
......@@ -111,7 +111,19 @@ func handleManifest(w http.ResponseWriter, r *http.Request, next http.Handler) e
return nil
}
log.Debugf("the tag is %v, digest is %v", art.Tag, art.Digest)
man, err := proxyCtl.ProxyManifest(ctx, p, art)
err = proxyManifest(ctx, w, r, next, proxyCtl, p, art)
if err != nil {
if errors.IsNotFoundErr(err) {
return err
}
log.Warningf("Proxy to remote failed, fallback to local repo, error: %v", err)
next.ServeHTTP(w, r)
}
return nil
}
func proxyManifest(ctx context.Context, w http.ResponseWriter, r *http.Request, next http.Handler, ctl proxy.Controller, p *models.Project, art lib.ArtifactInfo) error {
man, err := ctl.ProxyManifest(ctx, p, art)
if err != nil {
return err
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment