From 21249166dd3240b843dde1c9cbd91e0677c403a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=90=AF=E8=88=AA?= <101104760+ZhangSetSail@users.noreply.github.com> Date: Tue, 19 Nov 2024 23:24:21 +0800 Subject: [PATCH] fix: tag image failure (#2052) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张启航 <101104760+ZhangSetSail@users.noreply.github.com> --- builder/sources/image_containerd_client.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/builder/sources/image_containerd_client.go b/builder/sources/image_containerd_client.go index 9358ffaf0..ff62970dd 100644 --- a/builder/sources/image_containerd_client.go +++ b/builder/sources/image_containerd_client.go @@ -321,6 +321,13 @@ func (c *containerdImageCliImpl) ImageTag(source, target string, logger event.Lo return err } srcImage := srcNamed.String() + + if strings.HasPrefix(target, "https://") { + target = strings.TrimPrefix(target, "https://") + } else if strings.HasPrefix(target, "http://") { + target = strings.TrimPrefix(target, "http://") + } + targetNamed, err := refdocker.ParseDockerRef(target) if err != nil { return err