mirror of https://github.com/databricks/cli.git
Merge 4cf692924c
into 1db384018c
This commit is contained in:
commit
1bb1d2c453
|
@ -9,6 +9,7 @@ import (
|
|||
|
||||
"github.com/databricks/cli/bundle"
|
||||
"github.com/databricks/cli/bundle/config"
|
||||
"github.com/databricks/cli/libs/dbr"
|
||||
"github.com/databricks/cli/libs/diag"
|
||||
"github.com/databricks/cli/libs/dyn"
|
||||
"github.com/databricks/cli/libs/textutil"
|
||||
|
@ -221,6 +222,17 @@ func (m *applyPresets) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnos
|
|||
dashboard.DisplayName = prefix + dashboard.DisplayName
|
||||
}
|
||||
|
||||
if config.IsExplicitlyEnabled((b.Config.Presets.InPlaceDeployment)) {
|
||||
root := b.SyncRoot.Native()
|
||||
isInWorkspace := strings.HasPrefix(root, "/Workspace/")
|
||||
if isInWorkspace && dbr.RunsOnRuntime(ctx) {
|
||||
b.Config.Workspace.FilePath = b.SyncRootPath
|
||||
} else {
|
||||
disabled := false
|
||||
b.Config.Presets.InPlaceDeployment = &disabled
|
||||
}
|
||||
}
|
||||
|
||||
return diags
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import (
|
|||
"github.com/databricks/cli/bundle/config"
|
||||
"github.com/databricks/cli/bundle/config/mutator"
|
||||
"github.com/databricks/cli/bundle/config/resources"
|
||||
"github.com/databricks/cli/libs/vfs"
|
||||
"github.com/databricks/databricks-sdk-go/service/catalog"
|
||||
"github.com/databricks/databricks-sdk-go/service/jobs"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -55,6 +56,7 @@ func TestApplyPresetsPrefix(t *testing.T) {
|
|||
NamePrefix: tt.prefix,
|
||||
},
|
||||
},
|
||||
SyncRoot: vfs.MustNew(t.TempDir()),
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
|
@ -101,6 +103,7 @@ func TestApplyPresetsPrefixForUcSchema(t *testing.T) {
|
|||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
b := &bundle.Bundle{
|
||||
SyncRoot: vfs.MustNew(t.TempDir()),
|
||||
Config: config.Root{
|
||||
Resources: config.Resources{
|
||||
Schemas: map[string]*resources.Schema{
|
||||
|
@ -180,6 +183,7 @@ func TestApplyPresetsTags(t *testing.T) {
|
|||
Tags: tt.tags,
|
||||
},
|
||||
},
|
||||
SyncRoot: vfs.MustNew(t.TempDir()),
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
|
@ -239,6 +243,7 @@ func TestApplyPresetsJobsMaxConcurrentRuns(t *testing.T) {
|
|||
JobsMaxConcurrentRuns: tt.setting,
|
||||
},
|
||||
},
|
||||
SyncRoot: vfs.MustNew(t.TempDir()),
|
||||
}
|
||||
ctx := context.Background()
|
||||
diag := bundle.Apply(ctx, b, mutator.ApplyPresets())
|
||||
|
@ -264,6 +269,7 @@ func TestApplyPresetsPrefixWithoutJobSettings(t *testing.T) {
|
|||
NamePrefix: "prefix-",
|
||||
},
|
||||
},
|
||||
SyncRoot: vfs.MustNew(t.TempDir()),
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
|
@ -355,6 +361,7 @@ func TestApplyPresetsResourceNotDefined(t *testing.T) {
|
|||
TriggerPauseStatus: config.Paused,
|
||||
},
|
||||
},
|
||||
SyncRoot: vfs.MustNew(t.TempDir()),
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
|
|
|
@ -57,6 +57,11 @@ func transformDevelopmentMode(ctx context.Context, b *bundle.Bundle) {
|
|||
t.TriggerPauseStatus = config.Paused
|
||||
}
|
||||
|
||||
if !config.IsExplicitlyDisabled(t.InPlaceDeployment) {
|
||||
enabled := true
|
||||
t.InPlaceDeployment = &enabled
|
||||
}
|
||||
|
||||
if !config.IsExplicitlyDisabled(t.PipelinesDevelopment) {
|
||||
enabled := true
|
||||
t.PipelinesDevelopment = &enabled
|
||||
|
|
|
@ -11,6 +11,7 @@ import (
|
|||
"github.com/databricks/cli/bundle/config/resources"
|
||||
"github.com/databricks/cli/libs/diag"
|
||||
"github.com/databricks/cli/libs/tags"
|
||||
"github.com/databricks/cli/libs/vfs"
|
||||
sdkconfig "github.com/databricks/databricks-sdk-go/config"
|
||||
"github.com/databricks/databricks-sdk-go/service/catalog"
|
||||
"github.com/databricks/databricks-sdk-go/service/compute"
|
||||
|
@ -140,6 +141,7 @@ func mockBundle(mode config.Mode) *bundle.Bundle {
|
|||
},
|
||||
},
|
||||
},
|
||||
SyncRoot: vfs.MustNew("/Users/lennart.kats@databricks.com"),
|
||||
// Use AWS implementation for testing.
|
||||
Tagging: tags.ForCloud(&sdkconfig.Config{
|
||||
Host: "https://company.cloud.databricks.com",
|
||||
|
|
|
@ -17,6 +17,11 @@ type Presets struct {
|
|||
// JobsMaxConcurrentRuns is the default value for the max concurrent runs of jobs.
|
||||
JobsMaxConcurrentRuns int `json:"jobs_max_concurrent_runs,omitempty"`
|
||||
|
||||
// InPlaceDeployment indicates whether in-place deployment is enabled. Works only in workspace
|
||||
// When set to true, resources created during deployment will point to source files in the workspace instead of their workspace copies.
|
||||
// No resources will be uploaded to workspace
|
||||
InPlaceDeployment *bool `json:"in_place_deployment,omitempty"`
|
||||
|
||||
// Tags to add to all resources.
|
||||
Tags map[string]string `json:"tags,omitempty"`
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
"io/fs"
|
||||
|
||||
"github.com/databricks/cli/bundle"
|
||||
"github.com/databricks/cli/bundle/config"
|
||||
"github.com/databricks/cli/bundle/permissions"
|
||||
"github.com/databricks/cli/libs/cmdio"
|
||||
"github.com/databricks/cli/libs/diag"
|
||||
|
@ -23,6 +24,11 @@ func (m *upload) Name() string {
|
|||
}
|
||||
|
||||
func (m *upload) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnostics {
|
||||
if config.IsExplicitlyEnabled(b.Config.Presets.InPlaceDeployment) {
|
||||
cmdio.LogString(ctx, "Bundle files uploading skipped: in-place deployment is enabled")
|
||||
return nil
|
||||
}
|
||||
|
||||
cmdio.LogString(ctx, fmt.Sprintf("Uploading bundle files to %s...", b.Config.Workspace.FilePath))
|
||||
opts, err := GetSyncOptions(ctx, bundle.ReadOnly(b))
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue