func convertToSchema1(ctx context.Context, blobs distribution.BlobService, configJSON []byte, schema2Manifest *schema2.DeserializedManifest, ref reference.Named) (distribution.Manifest, error) {
	if configJSON == nil {
		targetDescriptor := schema2Manifest.Target()
		config, err := blobs.Get(ctx, targetDescriptor.Digest)
		if err != nil {
			return nil, err
		}
		configJSON = config
	}
	trustKey, err := loadPrivateKey()
	if err != nil {
		return nil, err
	}
	if klog.V(6).Enabled() {
		klog.Infof("Down converting v2 schema image:\n%#v\n%s", schema2Manifest.Layers, configJSON)
	}
	builder := schema1.NewConfigManifestBuilder(blobs, trustKey, ref, configJSON)
	for _, d := range schema2Manifest.Layers {
		if err := builder.AppendReference(d); err != nil {
			return nil, err
		}
	}
	manifest, err := builder.Build(ctx)
	if err != nil {
		return nil, err
	}
	return manifest, nil
}
// TODO: Remove support for v2 schema in 4.9
Remove support for v2 schema in 4.9
// TODO : Remove support for v2 schema in 4 . 9
func convertToSchema1(ctx context.Context, blobs distribution.BlobService, configJSON []byte, schema2Manifest *schema2.DeserializedManifest, ref reference.Named) (distribution.Manifest, error) {
	if configJSON == nil {
		targetDescriptor := schema2Manifest.Target()
		config, err := blobs.Get(ctx, targetDescriptor.Digest)
		if err != nil {
			return nil, err
		}
		configJSON = config
	}
	trustKey, err := loadPrivateKey()
	if err != nil {
		return nil, err
	}
	if klog.V(6).Enabled() {
		klog.Infof("Down converting v2 schema image:\n%#v\n%s", schema2Manifest.Layers, configJSON)
	}
	builder := schema1.NewConfigManifestBuilder(blobs, trustKey, ref, configJSON)
	for _, d := range schema2Manifest.Layers {
		if err := builder.AppendReference(d); err != nil {
			return nil, err
		}
	}
	manifest, err := builder.Build(ctx)
	if err != nil {
		return nil, err
	}
	return manifest, nil
}
func convertToSchema1 ( ctx context . Context , blobs distribution . BlobService , configJSON [ ] byte , schema2Manifest * schema2 . DeserializedManifest , ref reference . Named ) ( distribution . Manifest , error ) { if configJSON == nil { targetDescriptor := schema2Manifest . Target ( ) config , err := blobs . Get ( ctx , targetDescriptor . Digest ) if err != nil { return nil , err } configJSON = config } trustKey , err := loadPrivateKey ( ) if err != nil { return nil , err } if klog . V ( 6 ) . Enabled ( ) { klog . Infof ( " \n \n " , schema2Manifest . Layers , configJSON ) } builder := schema1 . NewConfigManifestBuilder ( blobs , trustKey , ref , configJSON ) for _ , d := range schema2Manifest . Layers { if err := builder . AppendReference ( d ) ; err != nil { return nil , err } } manifest , err := builder . Build ( ctx ) if err != nil { return nil , err } return manifest , nil }
Remove support for v2 schema in 4.9
Remove support for v2 schema in 4 . 9