@@ -28,6 +28,7 @@ import (
2828 modelspec "github.com/CloudNativeAI/model-spec/specs-go/v1"
2929 godigest "github.com/opencontainers/go-digest"
3030 ocispec "github.com/opencontainers/image-spec/specs-go/v1"
31+ "github.com/sirupsen/logrus"
3132
3233 internalpb "github.com/CloudNativeAI/modctl/internal/pb"
3334 "github.com/CloudNativeAI/modctl/pkg/backend/build"
5960
6061// Attach attaches user materials into the model artifact which follows the Model Spec.
6162func (b * backend ) Attach (ctx context.Context , filepath string , cfg * config.Attach ) error {
63+ logrus .Infof ("attaching file %s, cfg: %+v" , filepath , cfg )
6264 srcManifest , err := b .getManifest (ctx , cfg .Source , cfg .OutputRemote , cfg .PlainHTTP , cfg .Insecure )
6365 if err != nil {
6466 return fmt .Errorf ("failed to get source manifest: %w" , err )
@@ -69,6 +71,8 @@ func (b *backend) Attach(ctx context.Context, filepath string, cfg *config.Attac
6971 return fmt .Errorf ("failed to get source model config: %w" , err )
7072 }
7173
74+ logrus .Infof ("source model config: %+v" , srcModelConfig )
75+
7276 var foundLayer * ocispec.Descriptor
7377 for _ , layer := range srcManifest .Layers {
7478 if anno := layer .Annotations ; anno != nil {
@@ -83,6 +87,8 @@ func (b *backend) Attach(ctx context.Context, filepath string, cfg *config.Attac
8387 }
8488 }
8589
90+ logrus .Infof ("found original layer: %+v" , foundLayer )
91+
8692 layers := srcManifest .Layers
8793 if foundLayer != nil {
8894 // Remove the found layer from the layers slice as we need to replace it with the new layer.
@@ -117,6 +123,8 @@ func (b *backend) Attach(ctx context.Context, filepath string, cfg *config.Attac
117123 layers = append (layers , newLayers ... )
118124 sortLayers (layers )
119125
126+ logrus .Infof ("new sorted layers: %+v" , layers )
127+
120128 diffIDs := []godigest.Digest {}
121129 for _ , layer := range layers {
122130 diffIDs = append (diffIDs , layer .Digest )
@@ -136,6 +144,9 @@ func (b *backend) Attach(ctx context.Context, filepath string, cfg *config.Attac
136144 Family : srcModelConfig .Descriptor .Family ,
137145 Name : srcModelConfig .Descriptor .Name ,
138146 }
147+
148+ logrus .Infof ("new model config: %+v" , modelConfig )
149+
139150 configDesc , err := builder .BuildConfig (ctx , layers , modelConfig , hooks .NewHooks (
140151 hooks .WithOnStart (func (name string , size int64 , reader io.Reader ) io.Reader {
141152 return pb .Add (internalpb .NormalizePrompt ("Building config" ), name , size , reader )
0 commit comments