Update proxy cache to serve the image in local when it is removed in upstream

Add stacktrace in debug log

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
This commit is contained in:
stonezdj 2024-07-08 16:01:20 +08:00 committed by stonezdj(Daojun Zhang)
parent f86f1cebc3
commit 796c18a6ab
2 changed files with 3 additions and 3 deletions

View File

@ -172,9 +172,9 @@ func (c *controller) UseLocalManifest(ctx context.Context, art lib.ArtifactInfo,
return false, nil, err
}
if !exist || desc == nil {
return false, nil, errors.NotFoundError(fmt.Errorf("repo %v, tag %v not found", art.Repository, art.Tag))
log.Warningf("repo %v, tag %v not found in remote, fallback to local", art.Repository, art.Tag)
return true, nil, nil
}
var content []byte
var contentType string
if c.cache == nil {

View File

@ -59,7 +59,7 @@ func SendError(w http.ResponseWriter, err error) {
errPayload = errors.NewErrs(err).Error()
} else {
// only log the error whose status code < 500 when debugging to avoid log flooding
log.Debug(errPayload)
log.Debugf("%s %s", errPayload, stackTrace)
}
w.WriteHeader(statusCode)
fmt.Fprintln(w, errPayload)