From d5c75f4eee9112579dcbae54e3a4267a1ef03545 Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Thu, 9 May 2024 22:00:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E5=AE=B9=E5=99=A8?= =?UTF-8?q?=E9=95=9C=E5=83=8F=E6=8E=A8=E9=80=81=E5=A4=B1=E8=B4=A5=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20(#4944)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/image.go | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/backend/app/service/image.go b/backend/app/service/image.go index 2fb4008d7..105cecbc7 100644 --- a/backend/app/service/image.go +++ b/backend/app/service/image.go @@ -271,7 +271,7 @@ func (u *ImageService) ImagePull(req dto.ImagePull) (string, error) { if err != nil { return "", err } - options := types.ImagePullOptions{} + options := image.PullOptions{} if repo.Auth { authConfig := registry.AuthConfig{ Username: repo.Username, @@ -373,19 +373,17 @@ func (u *ImageService) ImagePush(req dto.ImagePush) (string, error) { if err != nil { return "", err } - options := types.ImagePushOptions{} - if repo.Auth { - authConfig := registry.AuthConfig{ - Username: repo.Username, - Password: repo.Password, - } - encodedJSON, err := json.Marshal(authConfig) - if err != nil { - return "", err - } - authStr := base64.URLEncoding.EncodeToString(encodedJSON) - options.RegistryAuth = authStr + options := image.PushOptions{All: true} + authConfig := registry.AuthConfig{ + Username: repo.Username, + Password: repo.Password, + } + encodedJSON, err := json.Marshal(authConfig) + if err != nil { + return "", err } + authStr := base64.URLEncoding.EncodeToString(encodedJSON) + options.RegistryAuth = authStr newName := fmt.Sprintf("%s/%s", repo.DownloadUrl, req.Name) if newName != req.TagName { if err := client.ImageTag(context.TODO(), req.TagName, newName); err != nil {