mirror of
https://github.com/project-zot/zot.git
synced 2026-06-17 12:58:02 +08:00
fix(sync): better cleaning sync's download dir (#2273)
added cleanup in the case of copy.Image() failures. Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
This commit is contained in:
@@ -441,6 +441,13 @@ func (service *BaseService) syncTag(ctx context.Context, destinationRepo, remote
|
||||
|
||||
_, err = copy.Image(ctx, policyContext, localImageRef, remoteImageRef, ©Options)
|
||||
if err != nil {
|
||||
// cleanup in cases of copy.Image errors while copying.
|
||||
if cErr := service.destination.CleanupImage(localImageRef, destinationRepo, tag); cErr != nil {
|
||||
service.log.Error().Err(err).Str("errortype", common.TypeOf(err)).
|
||||
Str("local image", fmt.Sprintf("%s:%s", destinationRepo, tag)).
|
||||
Msg("couldn't cleanup temp local image")
|
||||
}
|
||||
|
||||
service.log.Error().Err(err).Str("errortype", common.TypeOf(err)).
|
||||
Str("remote image", remoteImageRef.DockerReference().String()).
|
||||
Str("local image", fmt.Sprintf("%s:%s", destinationRepo, tag)).Msg("coulnd't sync image")
|
||||
|
||||
Reference in New Issue
Block a user