mirror of https://github.com/databricks/cli.git
feat: Move FilePath update to apply preset step
This commit is contained in:
parent
a43f7ddad0
commit
5a22151580
|
@ -222,13 +222,17 @@ func (m *applyPresets) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnos
|
|||
dashboard.DisplayName = prefix + dashboard.DisplayName
|
||||
}
|
||||
|
||||
root := b.SyncRoot.Native()
|
||||
_, ok := env.Lookup(ctx, envDatabricksRuntimeVersion)
|
||||
isInWorkspace := ok && strings.HasPrefix(root, "/Workspace/")
|
||||
if config.IsExplicitlyEnabled((b.Config.Presets.InPlaceDeployment)) {
|
||||
root := b.SyncRoot.Native()
|
||||
_, ok := env.Lookup(ctx, envDatabricksRuntimeVersion)
|
||||
isInWorkspace := ok && strings.HasPrefix(root, "/Workspace/")
|
||||
|
||||
if !isInWorkspace {
|
||||
disabled := false
|
||||
b.Config.Presets.InPlaceDeployment = &disabled
|
||||
if isInWorkspace {
|
||||
b.Config.Workspace.FilePath = b.BundleRootPath
|
||||
} else {
|
||||
disabled := false
|
||||
b.Config.Presets.InPlaceDeployment = &disabled
|
||||
}
|
||||
}
|
||||
|
||||
return diags
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
"path"
|
||||
|
||||
"github.com/databricks/cli/bundle"
|
||||
"github.com/databricks/cli/bundle/config"
|
||||
"github.com/databricks/cli/libs/diag"
|
||||
)
|
||||
|
||||
|
@ -26,10 +25,6 @@ func (m *defineDefaultWorkspacePaths) Apply(ctx context.Context, b *bundle.Bundl
|
|||
return diag.Errorf("unable to define default workspace paths: workspace root not defined")
|
||||
}
|
||||
|
||||
if config.IsExplicitlyEnabled((b.Config.Presets.InPlaceDeployment)) {
|
||||
b.Config.Workspace.FilePath = b.BundleRootPath
|
||||
}
|
||||
|
||||
if b.Config.Workspace.FilePath == "" {
|
||||
b.Config.Workspace.FilePath = path.Join(root, "files")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue