mirror of
https://github.com/containerd/containerd.git
synced 2026-08-08 09:01:21 +00:00
Merge pull request #11936 from k8s-infra-cherrypick-robot/cherry-pick-11915-to-release/2.1
[release/2.1] Fix transfer differ selection
This commit is contained in:
@@ -428,7 +428,7 @@ func (u *Unpacker) unpack(
|
||||
diff, err := a.Apply(ctx, desc, mounts, unpack.ApplyOpts...)
|
||||
if err != nil {
|
||||
cleanup.Do(ctx, abort)
|
||||
return fmt.Errorf("failed to extract layer %s: %w", diffIDs[i], err)
|
||||
return fmt.Errorf("failed to extract layer (%s %s) to %s as %q: %w", desc.MediaType, desc.Digest, unpack.SnapshotterKey, key, err)
|
||||
}
|
||||
if diff.Digest != diffIDs[i] {
|
||||
cleanup.Do(ctx, abort)
|
||||
|
||||
@@ -138,6 +138,7 @@ func (s *service) Transfer(ctx context.Context, req *transferapi.TransferRequest
|
||||
} else if !errdefs.IsNotImplemented(err) {
|
||||
return nil, errgrpc.ToGRPC(err)
|
||||
}
|
||||
log.G(ctx).WithError(err).Debugf("transfer not implemented for %T to %T", src, dst)
|
||||
}
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Transfer not implemented for %s to %s", req.Source.GetTypeUrl(), req.Destination.GetTypeUrl())
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import (
|
||||
"github.com/containerd/containerd/v2/core/metadata"
|
||||
"github.com/containerd/containerd/v2/core/transfer/local"
|
||||
"github.com/containerd/containerd/v2/core/unpack"
|
||||
"github.com/containerd/containerd/v2/defaults"
|
||||
"github.com/containerd/containerd/v2/internal/kmutex"
|
||||
"github.com/containerd/containerd/v2/pkg/imageverifier"
|
||||
"github.com/containerd/containerd/v2/plugins"
|
||||
@@ -115,6 +116,7 @@ func init() {
|
||||
}
|
||||
applier = inst.(diff.Applier)
|
||||
} else {
|
||||
var applierID string
|
||||
for name, plugin := range ic.GetAll() {
|
||||
if plugin.Registration.Type != plugins.DiffPlugin {
|
||||
continue
|
||||
@@ -129,14 +131,25 @@ func init() {
|
||||
continue
|
||||
}
|
||||
if applier != nil {
|
||||
log.G(ic.Context).Warnf("multiple differs match for platform, set `differ` option to choose, skipping %q", plugin.Registration.ID)
|
||||
continue
|
||||
skippedApplier := plugin.Registration.ID
|
||||
|
||||
// Prefer the default when multiple plugins match
|
||||
if skippedApplier == defaults.DefaultDiffer {
|
||||
skippedApplier = applierID
|
||||
}
|
||||
|
||||
log.G(ic.Context).Warnf("multiple differs match for platform, set `differ` option to choose, skipping %q", skippedApplier)
|
||||
|
||||
if plugin.Registration.ID == skippedApplier {
|
||||
continue
|
||||
}
|
||||
}
|
||||
inst, err := plugin.Instance()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get instance for diff plugin %q: %w", name, err)
|
||||
}
|
||||
applier = inst.(diff.Applier)
|
||||
applierID = plugin.Registration.ID
|
||||
}
|
||||
}
|
||||
if applier == nil {
|
||||
|
||||
Reference in New Issue
Block a user