|
@@ -34,7 +34,8 @@ import (
|
|
|
)
|
|
|
|
|
|
const (
|
|
|
- pullSpanPrefix = "pull"
|
|
|
+ pullSpanPrefix = "pull"
|
|
|
+ convertedDockerSchema1LabelKey = "io.containerd.image/converted-docker-schema1"
|
|
|
)
|
|
|
|
|
|
// Pull downloads the provided content into containerd's content store
|
|
@@ -189,9 +190,10 @@ func (c *Client) fetch(ctx context.Context, rCtx *RemoteContext, ref string, lim
|
|
|
var (
|
|
|
handler images.Handler
|
|
|
|
|
|
- isConvertible bool
|
|
|
- converterFunc func(context.Context, ocispec.Descriptor) (ocispec.Descriptor, error)
|
|
|
- limiter *semaphore.Weighted
|
|
|
+ isConvertible bool
|
|
|
+ originalSchema1Digest string
|
|
|
+ converterFunc func(context.Context, ocispec.Descriptor) (ocispec.Descriptor, error)
|
|
|
+ limiter *semaphore.Weighted
|
|
|
)
|
|
|
|
|
|
if desc.MediaType == images.MediaTypeDockerSchema1Manifest && rCtx.ConvertSchema1 {
|
|
@@ -204,6 +206,8 @@ func (c *Client) fetch(ctx context.Context, rCtx *RemoteContext, ref string, lim
|
|
|
converterFunc = func(ctx context.Context, _ ocispec.Descriptor) (ocispec.Descriptor, error) {
|
|
|
return schema1Converter.Convert(ctx)
|
|
|
}
|
|
|
+
|
|
|
+ originalSchema1Digest = desc.Digest.String()
|
|
|
} else {
|
|
|
// Get all the children for a descriptor
|
|
|
childrenHandler := images.ChildrenHandler(store)
|
|
@@ -270,6 +274,13 @@ func (c *Client) fetch(ctx context.Context, rCtx *RemoteContext, ref string, lim
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if originalSchema1Digest != "" {
|
|
|
+ if rCtx.Labels == nil {
|
|
|
+ rCtx.Labels = make(map[string]string)
|
|
|
+ }
|
|
|
+ rCtx.Labels[convertedDockerSchema1LabelKey] = originalSchema1Digest
|
|
|
+ }
|
|
|
+
|
|
|
return images.Image{
|
|
|
Name: name,
|
|
|
Target: desc,
|