fix(sync): revert code which removed image destination feature (#840)

Added an end to end test for this feature, closes #793

Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
This commit is contained in:
peusebiu
2022-10-05 21:03:24 +03:00
committed by GitHub
parent 33a431ef43
commit c146448f01
4 changed files with 196 additions and 16 deletions
+14 -14
View File
@@ -382,22 +382,22 @@ func syncRegistry(ctx context.Context, regCfg RegistryConfig,
}
remoteRepoCopy := remoteRepo
imageStore := storeController.GetImageStore(remoteRepoCopy)
localCachePath, err := getLocalCachePath(imageStore, remoteRepoCopy)
if err != nil {
log.Error().Str("errorType", TypeOf(err)).
Err(err).Msgf("couldn't get localCachePath for %s", remoteRepoCopy)
return err
}
if localCachePath != "" {
defer os.RemoveAll(localCachePath)
}
for _, image := range imageList {
localRepo := remoteRepoCopy
localRepo := getRepoDestination(remoteRepo, image.content)
imageStore := storeController.GetImageStore(localRepo)
localCachePath, err := getLocalCachePath(imageStore, localRepo)
if err != nil {
log.Error().Str("errorType", TypeOf(err)).
Err(err).Msgf("couldn't get localCachePath for %s", remoteRepoCopy)
return err
}
defer os.RemoveAll(localCachePath)
upstreamImageRef := image.ref
upstreamImageDigest, err := docker.GetDigest(ctx, upstreamCtx, upstreamImageRef)