From 46cb37c66c04c40251426472ea54c1f8ce5404e7 Mon Sep 17 00:00:00 2001 From: Keshav Date: Wed, 4 Oct 2023 11:30:23 +0200 Subject: [PATCH] including only copy correctly --- cmd/imagePushToRegistry.go | 12 ++++++------ pkg/docker/docker.go | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd/imagePushToRegistry.go b/cmd/imagePushToRegistry.go index 6cab946a64..f72b367402 100644 --- a/cmd/imagePushToRegistry.go +++ b/cmd/imagePushToRegistry.go @@ -128,19 +128,19 @@ func handleCredentialsForPrivateRegistries(dockerConfigJsonPath string, registry return errors.Wrapf(err, "failed to read enhanced file '%v'", dockerConfigJsonPath) } } else if len(dockerConfigJsonPath) == 0 && len(registryURL) > 0 && len(password) > 0 && len(username) > 0 { - targetConfigJson, err := docker.CreateDockerConfigJSON(registryURL, username, password, "", "/crane/.docker/config.json", fileUtils) + targetConfigJson, err := docker.CreateDockerConfigJSON(registryURL, username, password, "", "~/.docker/config.json", fileUtils) if err != nil { - return errors.Wrap(err, "failed to create new docker config json at /crane/.docker/config.json") + return errors.Wrap(err, "failed to create new docker config json at ~/.docker/config.json") } dockerConfig, err = fileUtils.FileRead(targetConfigJson) if err != nil { - return errors.Wrapf(err, "failed to read new docker config file at /crane/.docker/config.json") + return errors.Wrapf(err, "failed to read new docker config file at ~/.docker/config.json") } } - if err := fileUtils.FileWrite("/crane/.docker/config.json", dockerConfig, 0644); err != nil { - return errors.Wrap(err, "failed to write file '/crane/.docker/config.json'") + if err := fileUtils.FileWrite("~/.docker/config.json", dockerConfig, 0644); err != nil { + return errors.Wrap(err, "failed to write file '~/.docker/config.json'") } return nil } @@ -151,7 +151,7 @@ func pushLocalImageToTargetRegistry(localDockerImagePath string, targetRegistryU } func copyImage(sourceRegistry string, targetRegistry string) error { - + docker.CopyImage(sourceRegistry, targetRegistry) return nil } diff --git a/pkg/docker/docker.go b/pkg/docker/docker.go index 6eacca532a..d86ddabfc6 100644 --- a/pkg/docker/docker.go +++ b/pkg/docker/docker.go @@ -329,7 +329,7 @@ func ImageListWithFilePath(imageName string, excludes []string, trimDir string, return imageList, nil } -func (c *Client) CopyImage(src string, dest string) error { +func CopyImage(src string, dest string) error { crane.Copy(src, dest) return nil }