From bcbbd9538f154b985b6118e3713abb113ae6021a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Tue, 3 Oct 2023 14:06:00 +0200 Subject: [PATCH] c8d/progress: Show Mounted/Exists status MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Paweł Gronowski --- daemon/containerd/progress.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/daemon/containerd/progress.go b/daemon/containerd/progress.go index 13d228a310..0b2a893da4 100644 --- a/daemon/containerd/progress.go +++ b/daemon/containerd/progress.go @@ -8,9 +8,11 @@ import ( "github.com/containerd/containerd/content" cerrdefs "github.com/containerd/containerd/errdefs" + "github.com/containerd/containerd/images" "github.com/containerd/containerd/remotes" "github.com/containerd/containerd/remotes/docker" "github.com/containerd/log" + "github.com/distribution/reference" "github.com/docker/docker/internal/compatcontext" "github.com/docker/docker/pkg/progress" "github.com/docker/docker/pkg/stringid" @@ -209,8 +211,18 @@ func (p *pushProgress) UpdateProgress(ctx context.Context, ongoing *jobs, out pr } if status.Committed && status.Offset >= status.Total { - if p.isMountable(j.Digest) { - progress.Update(out, id, "Mounted") + if status.MountedFrom != "" { + from := status.MountedFrom + if ref, err := reference.ParseNormalizedNamed(from); err == nil { + from = reference.Path(ref) + } + progress.Update(out, id, "Mounted from "+from) + } else if status.Exists { + if images.IsLayerType(j.MediaType) { + progress.Update(out, id, "Layer already exists") + } else { + progress.Update(out, id, "Already exists") + } } else { progress.Update(out, id, "Pushed") }