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>
This commit is contained in:
Paweł Gronowski 2023-10-03 14:49:14 +02:00
parent 591c98cdbe
commit 77f7c83114
No known key found for this signature in database
GPG key ID: B85EFCFE26DEF92A

View file

@ -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
switch {
case containerdimages.IsIndexType(desc.MediaType),
containerdimages.IsManifestType(desc.MediaType),
containerdimages.IsConfigType(desc.MediaType):
default:
jobsQueue.Add(desc)
}
for _, c := range children {
jobsQueue.Add(c)
}
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)