@@ -28,8 +28,8 @@ import (
2828 porto "github.com/yandex/porto/src/api/go"
2929 portorpc "github.com/yandex/porto/src/api/go/rpc"
3030
31- _ "github.com/docker/distribution/manifest/schema1"
32- _ "github.com/docker/distribution/manifest/schema2"
31+ "github.com/docker/distribution/manifest/schema1"
32+ "github.com/docker/distribution/manifest/schema2"
3333 "github.com/docker/distribution/reference"
3434 "github.com/docker/distribution/registry/client"
3535 "github.com/docker/distribution/registry/client/transport"
@@ -405,8 +405,17 @@ func (b *Box) Spool(ctx context.Context, name string, opts isolate.Profile) (err
405405 return err
406406 }
407407 apexctx .GetLogger (ctx ).WithField ("name" , name ).Infof ("create a layer %s in Porto with merge" , layerName )
408+ var order layersOrder
409+ switch manifest .(type ) {
410+ case schema1.SignedManifest , * schema1.SignedManifest :
411+ order = layerOrderV1
412+ case schema2.DeserializedManifest , * schema2.DeserializedManifest :
413+ order = layerOrderV2
414+ default :
415+ return fmt .Errorf ("unknown manifest type %T" , manifest )
416+ }
408417
409- for _ , descriptor := range manifest .References () {
418+ for _ , descriptor := range order ( manifest .References () ) {
410419 blobPath , err := b .blobRepo .Get (ctx , repo , descriptor .Digest )
411420 if err != nil {
412421 return err
0 commit comments