Browse Source

c8d/push: Show progress only on blobs

To match the graphdriver's push behavior which only shows the progress
for layers.
Exclude indexes, manifests and image configs from the push progress.
Don't explicitly check for `IsLayerType` to also handle other
potentially big blobs (like buildkit attestations).

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Paweł Gronowski 1 year ago
parent
commit
77f7c83114
1 changed files with 8 additions and 10 deletions
  1. 8 10
      daemon/containerd/image_push.go

+ 8 - 10
daemon/containerd/image_push.go

@@ -134,24 +134,22 @@ func (i *ImageService) pushRef(ctx context.Context, targetRef reference.Named, m
 		return err
 	}
 
-	addChildrenToJobs := containerdimages.HandlerFunc(
+	addLayerJobs := containerdimages.HandlerFunc(
 		func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) {
-			children, err := containerdimages.Children(ctx, store, desc)
-			if err != nil {
-				return nil, err
-			}
-			for _, c := range children {
-				jobsQueue.Add(c)
+			switch {
+			case containerdimages.IsIndexType(desc.MediaType),
+				containerdimages.IsManifestType(desc.MediaType),
+				containerdimages.IsConfigType(desc.MediaType):
+			default:
+				jobsQueue.Add(desc)
 			}
 
-			jobsQueue.Add(desc)
-
 			return nil, nil
 		},
 	)
 
 	handlerWrapper := func(h images.Handler) images.Handler {
-		return containerdimages.Handlers(addChildrenToJobs, h)
+		return containerdimages.Handlers(addLayerJobs, h)
 	}
 
 	err = remotes.PushContent(ctx, pusher, target, store, limiter, platforms.All, handlerWrapper)