c8d/push: Set distribution source recursively

After a successful push, all pushed blobs should have a
distribution.source label pointing to the new registry.

Before this commit, the label was only appended to the top-level blob
(manifest or manifest list). Adjust this to also do that recursively to
its children.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Paweł Gronowski 2023-10-16 17:07:39 +02:00
parent 44dbbeb196
commit 488559a330
No known key found for this signature in database
GPG key ID: B85EFCFE26DEF92A

View file

@ -182,7 +182,8 @@ func appendDistributionSourceLabel(ctx context.Context, realStore content.Store,
return
}
if err := containerdimages.Dispatch(ctx, appendSource, nil, target); err != nil {
handler := presentChildrenHandler(realStore, appendSource)
if err := containerdimages.Dispatch(ctx, handler, nil, target); err != nil {
// Shouldn't happen, but even if it would fail, then make it only a warning
// because it doesn't affect the pushed data.
log.G(ctx).WithError(err).Warn("failed to append distribution source labels to pushed content")