From 1d7b27e0ef4bb34ced32d7e9149390edce849bd5 Mon Sep 17 00:00:00 2001 From: Ilya Kuznetsov Date: Mon, 18 Nov 2024 17:21:33 +0100 Subject: [PATCH] feat: Rename "in-place" to "source-linked" --- bundle/config/mutator/apply_presets.go | 6 +++--- bundle/config/mutator/apply_presets_test.go | 12 ++++++------ bundle/config/mutator/process_target_mode.go | 4 ++-- .../config/mutator/process_target_mode_test.go | 18 +++++++++--------- bundle/config/presets.go | 4 ++-- bundle/deploy/files/upload.go | 4 ++-- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/bundle/config/mutator/apply_presets.go b/bundle/config/mutator/apply_presets.go index e41bdf9c39..a376e3033e 100644 --- a/bundle/config/mutator/apply_presets.go +++ b/bundle/config/mutator/apply_presets.go @@ -222,15 +222,15 @@ func (m *applyPresets) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnos dashboard.DisplayName = prefix + dashboard.DisplayName } - if config.IsExplicitlyEnabled((b.Config.Presets.InPlaceDeployment)) { + if config.IsExplicitlyEnabled((b.Config.Presets.SourceLinkedDeployment)) { root := b.SyncRootPath isInWorkspace := strings.HasPrefix(root, "/Workspace/") if isInWorkspace && dbr.RunsOnRuntime(ctx) { b.Config.Workspace.FilePath = root } else { disabled := false - b.Config.Presets.InPlaceDeployment = &disabled - diags = diags.Extend(diag.Warningf("in-place deployment is available only in the Databricks Workspace")) + b.Config.Presets.SourceLinkedDeployment = &disabled + diags = diags.Extend(diag.Warningf("source-linked deployment is available only in the Databricks Workspace")) } } diff --git a/bundle/config/mutator/apply_presets_test.go b/bundle/config/mutator/apply_presets_test.go index f70831abbd..8aa2addd95 100644 --- a/bundle/config/mutator/apply_presets_test.go +++ b/bundle/config/mutator/apply_presets_test.go @@ -369,9 +369,9 @@ func TestApplyPresetsResourceNotDefined(t *testing.T) { } } -func TestApplyPresetsInPlaceDeployment(t *testing.T) { +func TestApplyPresetsSourceLinkedDeployment(t *testing.T) { if runtime.GOOS == "windows" { - t.Skip("this test is not applicable on Windows because in-place works only in the Databricks Workspace") + t.Skip("this test is not applicable on Windows because source-linked mode works only in the Databricks Workspace") } testContext := context.Background() @@ -405,7 +405,7 @@ func TestApplyPresetsInPlaceDeployment(t *testing.T) { initialValue: &enabled, expectedValue: &disabled, expectedFilePath: remotePath, - expectedWarning: "in-place deployment is available only in the Databricks Workspace", + expectedWarning: "source-linked deployment is available only in the Databricks Workspace", }, { name: "preset enabled, bundle in Workspace, not databricks runtime", @@ -414,7 +414,7 @@ func TestApplyPresetsInPlaceDeployment(t *testing.T) { initialValue: &enabled, expectedValue: &disabled, expectedFilePath: remotePath, - expectedWarning: "in-place deployment is available only in the Databricks Workspace", + expectedWarning: "source-linked deployment is available only in the Databricks Workspace", }, { name: "preset disabled, bundle in Workspace, databricks runtime", @@ -441,7 +441,7 @@ func TestApplyPresetsInPlaceDeployment(t *testing.T) { SyncRootPath: tt.bundlePath, Config: config.Root{ Presets: config.Presets{ - InPlaceDeployment: tt.initialValue, + SourceLinkedDeployment: tt.initialValue, }, Workspace: config.Workspace{ FilePath: remotePath, @@ -459,7 +459,7 @@ func TestApplyPresetsInPlaceDeployment(t *testing.T) { } require.Equal(t, tt.expectedFilePath, b.Config.Workspace.FilePath) - require.Equal(t, tt.expectedValue, b.Config.Presets.InPlaceDeployment) + require.Equal(t, tt.expectedValue, b.Config.Presets.SourceLinkedDeployment) }) } diff --git a/bundle/config/mutator/process_target_mode.go b/bundle/config/mutator/process_target_mode.go index 16b81ebb59..77bb54cbd5 100644 --- a/bundle/config/mutator/process_target_mode.go +++ b/bundle/config/mutator/process_target_mode.go @@ -58,12 +58,12 @@ func transformDevelopmentMode(ctx context.Context, b *bundle.Bundle) { t.TriggerPauseStatus = config.Paused } - if !config.IsExplicitlyDisabled(t.InPlaceDeployment) { + if !config.IsExplicitlyDisabled(t.SourceLinkedDeployment) { root := b.SyncRootPath isInWorkspace := strings.HasPrefix(root, "/Workspace/") if isInWorkspace && dbr.RunsOnRuntime(ctx) { enabled := true - t.InPlaceDeployment = &enabled + t.SourceLinkedDeployment = &enabled } } diff --git a/bundle/config/mutator/process_target_mode_test.go b/bundle/config/mutator/process_target_mode_test.go index e848e9f223..d6985bdaf5 100644 --- a/bundle/config/mutator/process_target_mode_test.go +++ b/bundle/config/mutator/process_target_mode_test.go @@ -520,23 +520,23 @@ func TestPipelinesDevelopmentDisabled(t *testing.T) { assert.False(t, b.Config.Resources.Pipelines["pipeline1"].PipelineSpec.Development) } -func TestInPlaceDeploymentEnabled(t *testing.T) { - b, diags := processInPlaceBundle(t, true) +func TestSourceLinkedDeploymentEnabled(t *testing.T) { + b, diags := processSourceLinkedBundle(t, true) require.NoError(t, diags.Error()) - assert.True(t, *b.Config.Presets.InPlaceDeployment) + assert.True(t, *b.Config.Presets.SourceLinkedDeployment) assert.Equal(t, b.Config.Workspace.FilePath, b.SyncRootPath) } -func TestInPlaceDeploymentDisabled(t *testing.T) { - b, diags := processInPlaceBundle(t, false) +func TestSourceLinkedDeploymentDisabled(t *testing.T) { + b, diags := processSourceLinkedBundle(t, false) require.NoError(t, diags.Error()) - assert.False(t, *b.Config.Presets.InPlaceDeployment) + assert.False(t, *b.Config.Presets.SourceLinkedDeployment) assert.NotEqual(t, b.Config.Workspace.FilePath, b.SyncRootPath) } -func processInPlaceBundle(t *testing.T, presetEnabled bool) (*bundle.Bundle, diag.Diagnostics) { +func processSourceLinkedBundle(t *testing.T, presetEnabled bool) (*bundle.Bundle, diag.Diagnostics) { if runtime.GOOS == "windows" { - t.Skip("this test is not applicable on Windows because in-place works only in the Databricks Workspace") + t.Skip("this test is not applicable on Windows because source-linked mode works only in the Databricks Workspace") } b := mockBundle(config.Development) @@ -544,7 +544,7 @@ func processInPlaceBundle(t *testing.T, presetEnabled bool) (*bundle.Bundle, dia workspacePath := "/Workspace/lennart@company.com/" b.SyncRoot = vfs.MustNew(workspacePath) b.SyncRootPath = workspacePath - b.Config.Presets.InPlaceDeployment = &presetEnabled + b.Config.Presets.SourceLinkedDeployment = &presetEnabled ctx := dbr.MockRuntime(context.Background(), true) m := bundle.Seq(ProcessTargetMode(), ApplyPresets()) diff --git a/bundle/config/presets.go b/bundle/config/presets.go index c5fb6e10e8..14c0d8a2da 100644 --- a/bundle/config/presets.go +++ b/bundle/config/presets.go @@ -17,10 +17,10 @@ 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 + // SourceLinkedDeployment indicates whether source-linked deployment is enabled. Works only in Databricks 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"` + SourceLinkedDeployment *bool `json:"source_linked_deployment,omitempty"` // Tags to add to all resources. Tags map[string]string `json:"tags,omitempty"` diff --git a/bundle/deploy/files/upload.go b/bundle/deploy/files/upload.go index bdad6f015d..f4b2b3f416 100644 --- a/bundle/deploy/files/upload.go +++ b/bundle/deploy/files/upload.go @@ -24,8 +24,8 @@ 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") + if config.IsExplicitlyEnabled(b.Config.Presets.SourceLinkedDeployment) { + cmdio.LogString(ctx, "Source-linked deployment is enabled. Resources will point to the source files directly without making copies") return nil }