Skip to content

Commit

Permalink
Resolve referenced models in dev command
Browse files Browse the repository at this point in the history
Resolves the kitfile for referenced models
before starting the dev server.
  • Loading branch information
gorkem committed Apr 30, 2024
1 parent 83eb8ad commit 93739be
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pkg/cmd/dev/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ package dev

import (
"context"
"fmt"
"kitops/pkg/artifact"
"kitops/pkg/lib/filesystem"
"kitops/pkg/lib/harness"
kfutils "kitops/pkg/lib/kitfile"
"kitops/pkg/output"
"os"
)
Expand All @@ -36,7 +38,15 @@ func runDev(ctx context.Context, options *DevOptions) error {
if err := kitfile.LoadModel(modelfile); err != nil {
return err
}
output.Infof("Loaded Kitfile: %s", kitfile.Model.Path)
output.Infof("Loaded Kitfile: %s", options.modelFile)
if kfutils.IsModelKitReference(kitfile.Model.Path) {
resolvedKitfile, err := kfutils.ResolveKitfile(ctx, options.configHome, kitfile.Model.Path, kitfile.Model.Path)
if err != nil {
return fmt.Errorf("Failed to resolve referenced modelkit %s: %w", kitfile.Model.Path, err)
}
kitfile.Model.Path = resolvedKitfile.Model.Path
kitfile.Model.Parts = append(kitfile.Model.Parts, resolvedKitfile.Model.Parts...)
}
modelPath, _, err := filesystem.VerifySubpath(options.contextDir, kitfile.Model.Path)
if err != nil {
return err
Expand Down

0 comments on commit 93739be

Please sign in to comment.