From d6f96a12808817f465a4e20844436f14b25d907c Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Thu, 28 May 2026 12:05:41 +0000 Subject: [PATCH 01/10] bundle/env: add DATABRICKS_BUNDLE_MANAGED_STATE flag helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds the env-var building block that opts a bundle into the deployment metadata service (DMS) for locking and resource-state management. The flag itself has no consumers yet — wiring it into the lock and statemgmt paths comes in follow-up PRs so the change set per PR stays small. IsManagedState treats the variable as a boolean (true/false, 1/0, yes/no, on/off, case-insensitive) and defaults to false when unset, so the historical filesystem-based behavior is unchanged. Co-authored-by: Isaac --- bundle/env/deployment_metadata.go | 23 +++++++++++++ bundle/env/deployment_metadata_test.go | 46 ++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 bundle/env/deployment_metadata.go create mode 100644 bundle/env/deployment_metadata_test.go diff --git a/bundle/env/deployment_metadata.go b/bundle/env/deployment_metadata.go new file mode 100644 index 0000000000..4365473efd --- /dev/null +++ b/bundle/env/deployment_metadata.go @@ -0,0 +1,23 @@ +package env + +import ( + "context" + + envlib "github.com/databricks/cli/libs/env" +) + +// managedStateVariable names the environment variable that opts a bundle into +// the deployment metadata service (DMS) for locking and resource-state +// management. Defaults to the historical filesystem-based behavior when +// unset. +// +// The variable is treated as a boolean and accepts the usual spellings: +// "true"/"false", "1"/"0", "yes"/"no", "on"/"off" (case-insensitive). +const managedStateVariable = "DATABRICKS_BUNDLE_MANAGED_STATE" + +// IsManagedState reports whether the DATABRICKS_BUNDLE_MANAGED_STATE +// environment variable is set to a truthy value. +func IsManagedState(ctx context.Context) bool { + v, ok := envlib.GetBool(ctx, managedStateVariable) + return ok && v +} diff --git a/bundle/env/deployment_metadata_test.go b/bundle/env/deployment_metadata_test.go new file mode 100644 index 0000000000..23224c9315 --- /dev/null +++ b/bundle/env/deployment_metadata_test.go @@ -0,0 +1,46 @@ +package env + +import ( + "testing" + + "github.com/databricks/cli/internal/testutil" + "github.com/stretchr/testify/assert" +) + +func TestIsManagedState(t *testing.T) { + cases := []struct { + value string + want bool + }{ + {"true", true}, + {"TRUE", true}, + {"1", true}, + {"yes", true}, + {"on", true}, + {"false", false}, + {"0", false}, + {"no", false}, + {"off", false}, + {"", false}, + } + for _, tc := range cases { + t.Run(tc.value, func(t *testing.T) { + testutil.CleanupEnvironment(t) + if tc.value != "" { + t.Setenv(managedStateVariable, tc.value) + } + assert.Equal(t, tc.want, IsManagedState(t.Context())) + }) + } +} + +func TestIsManagedStateUnset(t *testing.T) { + testutil.CleanupEnvironment(t) + assert.False(t, IsManagedState(t.Context())) +} + +func TestIsManagedStateGarbageValueFallsBackToFalse(t *testing.T) { + testutil.CleanupEnvironment(t) + t.Setenv(managedStateVariable, "garbage") + assert.False(t, IsManagedState(t.Context())) +} From 2d8cf7cb20b1ce502f90e87239a4d30c93584f01 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Sun, 31 May 2026 23:41:44 +0200 Subject: [PATCH 02/10] bundle: store managed_state in deployment config, apply via mutator Adds bundle.deployment.managed_state (*bool) so users can opt into the deployment metadata service from databricks.yml as well as via the DATABRICKS_BUNDLE_MANAGED_STATE environment variable. A new ApplyManagedStateEnv mutator (registered in DefaultMutators after EntryPoint) bridges the env var into the config field; configuration takes priority over the environment variable, matching the precedent set by bundle.engine / DATABRICKS_BUNDLE_ENGINE. After DefaultMutators runs, b.Config.Bundle.Deployment.ManagedState is the single source of truth for all downstream consumers. Co-authored-by: Shreyas Goenka --- bundle/config/deployment.go | 7 ++ .../config/mutator/apply_managed_state_env.go | 35 ++++++ .../mutator/apply_managed_state_env_test.go | 104 ++++++++++++++++++ bundle/config/mutator/mutator.go | 1 + bundle/env/deployment_metadata.go | 22 +--- bundle/env/deployment_metadata_test.go | 46 -------- 6 files changed, 151 insertions(+), 64 deletions(-) create mode 100644 bundle/config/mutator/apply_managed_state_env.go create mode 100644 bundle/config/mutator/apply_managed_state_env_test.go delete mode 100644 bundle/env/deployment_metadata_test.go diff --git a/bundle/config/deployment.go b/bundle/config/deployment.go index b7efb4456f..5820f14674 100644 --- a/bundle/config/deployment.go +++ b/bundle/config/deployment.go @@ -7,4 +7,11 @@ type Deployment struct { // Lock configures locking behavior on deployment. Lock Lock `json:"lock,omitempty"` + + // ManagedState opts the bundle into the deployment metadata service (DMS) + // for locking and resource-state management. Defaults to false (historical + // filesystem-based behavior). Can also be set with the + // DATABRICKS_BUNDLE_MANAGED_STATE environment variable; configuration takes + // priority over the environment variable. + ManagedState *bool `json:"managed_state,omitempty"` } diff --git a/bundle/config/mutator/apply_managed_state_env.go b/bundle/config/mutator/apply_managed_state_env.go new file mode 100644 index 0000000000..e61195d251 --- /dev/null +++ b/bundle/config/mutator/apply_managed_state_env.go @@ -0,0 +1,35 @@ +package mutator + +import ( + "context" + + "github.com/databricks/cli/bundle" + bundleenv "github.com/databricks/cli/bundle/env" + "github.com/databricks/cli/libs/diag" + envlib "github.com/databricks/cli/libs/env" +) + +type applyManagedStateEnv struct{} + +// ApplyManagedStateEnv reads DATABRICKS_BUNDLE_MANAGED_STATE and writes it +// into bundle.deployment.managed_state when the field is not already set in +// configuration. Configuration takes priority over the environment variable. +func ApplyManagedStateEnv() bundle.Mutator { + return &applyManagedStateEnv{} +} + +func (m *applyManagedStateEnv) Name() string { + return "ApplyManagedStateEnv" +} + +func (m *applyManagedStateEnv) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnostics { + if b.Config.Bundle.Deployment.ManagedState != nil { + return nil + } + v, ok := envlib.GetBool(ctx, bundleenv.ManagedStateVariable) + if !ok { + return nil + } + b.Config.Bundle.Deployment.ManagedState = &v + return nil +} diff --git a/bundle/config/mutator/apply_managed_state_env_test.go b/bundle/config/mutator/apply_managed_state_env_test.go new file mode 100644 index 0000000000..cef744c687 --- /dev/null +++ b/bundle/config/mutator/apply_managed_state_env_test.go @@ -0,0 +1,104 @@ +package mutator_test + +import ( + "testing" + + "github.com/databricks/cli/bundle" + "github.com/databricks/cli/bundle/config" + "github.com/databricks/cli/bundle/config/mutator" + "github.com/databricks/cli/internal/testutil" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func makeBundle(managedState *bool) *bundle.Bundle { + b := &bundle.Bundle{} + b.Config.Bundle.Deployment.ManagedState = managedState + return b +} + +//go:fix inline +func boolPtr(v bool) *bool { return new(v) } + +func TestApplyManagedStateEnvSetsFromEnvVar(t *testing.T) { + cases := []struct { + value string + want bool + }{ + {"true", true}, + {"TRUE", true}, + {"1", true}, + {"yes", true}, + {"on", true}, + {"false", false}, + {"0", false}, + {"no", false}, + {"off", false}, + } + for _, tc := range cases { + t.Run(tc.value, func(t *testing.T) { + testutil.CleanupEnvironment(t) + t.Setenv("DATABRICKS_BUNDLE_MANAGED_STATE", tc.value) + b := makeBundle(nil) + diags := bundle.Apply(t.Context(), b, mutator.ApplyManagedStateEnv()) + require.NoError(t, diags.Error()) + require.NotNil(t, b.Config.Bundle.Deployment.ManagedState) + assert.Equal(t, tc.want, *b.Config.Bundle.Deployment.ManagedState) + }) + } +} + +func TestApplyManagedStateEnvUnset(t *testing.T) { + testutil.CleanupEnvironment(t) + b := makeBundle(nil) + diags := bundle.Apply(t.Context(), b, mutator.ApplyManagedStateEnv()) + require.NoError(t, diags.Error()) + assert.Nil(t, b.Config.Bundle.Deployment.ManagedState) +} + +func TestApplyManagedStateEnvGarbageValueFallsBackToFalse(t *testing.T) { + testutil.CleanupEnvironment(t) + t.Setenv("DATABRICKS_BUNDLE_MANAGED_STATE", "garbage") + b := makeBundle(nil) + diags := bundle.Apply(t.Context(), b, mutator.ApplyManagedStateEnv()) + require.NoError(t, diags.Error()) + // GetBool treats unrecognised values as false (ok=true), so the field is set. + require.NotNil(t, b.Config.Bundle.Deployment.ManagedState) + assert.False(t, *b.Config.Bundle.Deployment.ManagedState) +} + +func TestApplyManagedStateEnvConfigTakesPriority(t *testing.T) { + cases := []struct { + name string + configValue bool + envValue string + }{ + {"config true, env false", true, "false"}, + {"config false, env true", false, "true"}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + testutil.CleanupEnvironment(t) + t.Setenv("DATABRICKS_BUNDLE_MANAGED_STATE", tc.envValue) + b := makeBundle(new(tc.configValue)) + diags := bundle.Apply(t.Context(), b, mutator.ApplyManagedStateEnv()) + require.NoError(t, diags.Error()) + require.NotNil(t, b.Config.Bundle.Deployment.ManagedState) + assert.Equal(t, tc.configValue, *b.Config.Bundle.Deployment.ManagedState) + }) + } +} + +// Verify the config field is accessible at the expected path in databricks.yml. +func TestApplyManagedStateEnvConfigPath(t *testing.T) { + b := &bundle.Bundle{ + Config: config.Root{ + Bundle: config.Bundle{ + Deployment: config.Deployment{ + ManagedState: new(true), + }, + }, + }, + } + assert.True(t, *b.Config.Bundle.Deployment.ManagedState) +} diff --git a/bundle/config/mutator/mutator.go b/bundle/config/mutator/mutator.go index a00488a50f..896ca30e30 100644 --- a/bundle/config/mutator/mutator.go +++ b/bundle/config/mutator/mutator.go @@ -13,6 +13,7 @@ import ( func DefaultMutators(ctx context.Context, b *bundle.Bundle) { bundle.ApplySeqContext(ctx, b, loader.EntryPoint(), + ApplyManagedStateEnv(), // Execute preinit script before processing includes. // It needs to be done before processing configuration files to allow diff --git a/bundle/env/deployment_metadata.go b/bundle/env/deployment_metadata.go index 4365473efd..3ffca624a9 100644 --- a/bundle/env/deployment_metadata.go +++ b/bundle/env/deployment_metadata.go @@ -1,23 +1,9 @@ package env -import ( - "context" - - envlib "github.com/databricks/cli/libs/env" -) - -// managedStateVariable names the environment variable that opts a bundle into -// the deployment metadata service (DMS) for locking and resource-state -// management. Defaults to the historical filesystem-based behavior when -// unset. +// ManagedStateVariable opts a bundle into the deployment metadata service +// (DMS) for locking and resource-state management. Defaults to the historical +// filesystem-based behavior when unset. // // The variable is treated as a boolean and accepts the usual spellings: // "true"/"false", "1"/"0", "yes"/"no", "on"/"off" (case-insensitive). -const managedStateVariable = "DATABRICKS_BUNDLE_MANAGED_STATE" - -// IsManagedState reports whether the DATABRICKS_BUNDLE_MANAGED_STATE -// environment variable is set to a truthy value. -func IsManagedState(ctx context.Context) bool { - v, ok := envlib.GetBool(ctx, managedStateVariable) - return ok && v -} +const ManagedStateVariable = "DATABRICKS_BUNDLE_MANAGED_STATE" diff --git a/bundle/env/deployment_metadata_test.go b/bundle/env/deployment_metadata_test.go deleted file mode 100644 index 23224c9315..0000000000 --- a/bundle/env/deployment_metadata_test.go +++ /dev/null @@ -1,46 +0,0 @@ -package env - -import ( - "testing" - - "github.com/databricks/cli/internal/testutil" - "github.com/stretchr/testify/assert" -) - -func TestIsManagedState(t *testing.T) { - cases := []struct { - value string - want bool - }{ - {"true", true}, - {"TRUE", true}, - {"1", true}, - {"yes", true}, - {"on", true}, - {"false", false}, - {"0", false}, - {"no", false}, - {"off", false}, - {"", false}, - } - for _, tc := range cases { - t.Run(tc.value, func(t *testing.T) { - testutil.CleanupEnvironment(t) - if tc.value != "" { - t.Setenv(managedStateVariable, tc.value) - } - assert.Equal(t, tc.want, IsManagedState(t.Context())) - }) - } -} - -func TestIsManagedStateUnset(t *testing.T) { - testutil.CleanupEnvironment(t) - assert.False(t, IsManagedState(t.Context())) -} - -func TestIsManagedStateGarbageValueFallsBackToFalse(t *testing.T) { - testutil.CleanupEnvironment(t) - t.Setenv(managedStateVariable, "garbage") - assert.False(t, IsManagedState(t.Context())) -} From 5a8120970ea7ddc2736189a9d29c8f8a05d95f4d Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Sun, 31 May 2026 23:47:22 +0200 Subject: [PATCH 03/10] bundle: only treat \"true\" as managed state; drop GetBool Follow the same simple-string pattern as DATABRICKS_BUNDLE_ENGINE: only the exact value "true" enables managed state, any other value is ignored. Removes the TestApplyManagedStateEnvConfigPath test which only verified struct field assignment. Co-authored-by: Shreyas Goenka --- .../config/mutator/apply_managed_state_env.go | 7 +- .../mutator/apply_managed_state_env_test.go | 89 ++++--------------- 2 files changed, 23 insertions(+), 73 deletions(-) diff --git a/bundle/config/mutator/apply_managed_state_env.go b/bundle/config/mutator/apply_managed_state_env.go index e61195d251..998774be8e 100644 --- a/bundle/config/mutator/apply_managed_state_env.go +++ b/bundle/config/mutator/apply_managed_state_env.go @@ -14,6 +14,7 @@ type applyManagedStateEnv struct{} // ApplyManagedStateEnv reads DATABRICKS_BUNDLE_MANAGED_STATE and writes it // into bundle.deployment.managed_state when the field is not already set in // configuration. Configuration takes priority over the environment variable. +// Only the value "true" enables managed state; any other value is ignored. func ApplyManagedStateEnv() bundle.Mutator { return &applyManagedStateEnv{} } @@ -26,10 +27,10 @@ func (m *applyManagedStateEnv) Apply(ctx context.Context, b *bundle.Bundle) diag if b.Config.Bundle.Deployment.ManagedState != nil { return nil } - v, ok := envlib.GetBool(ctx, bundleenv.ManagedStateVariable) - if !ok { + if envlib.Get(ctx, bundleenv.ManagedStateVariable) != "true" { return nil } - b.Config.Bundle.Deployment.ManagedState = &v + enabled := true + b.Config.Bundle.Deployment.ManagedState = &enabled return nil } diff --git a/bundle/config/mutator/apply_managed_state_env_test.go b/bundle/config/mutator/apply_managed_state_env_test.go index cef744c687..818e9afe1e 100644 --- a/bundle/config/mutator/apply_managed_state_env_test.go +++ b/bundle/config/mutator/apply_managed_state_env_test.go @@ -4,101 +4,50 @@ import ( "testing" "github.com/databricks/cli/bundle" - "github.com/databricks/cli/bundle/config" "github.com/databricks/cli/bundle/config/mutator" "github.com/databricks/cli/internal/testutil" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) -func makeBundle(managedState *bool) *bundle.Bundle { +func TestApplyManagedStateEnvTrue(t *testing.T) { + testutil.CleanupEnvironment(t) + t.Setenv("DATABRICKS_BUNDLE_MANAGED_STATE", "true") b := &bundle.Bundle{} - b.Config.Bundle.Deployment.ManagedState = managedState - return b + diags := bundle.Apply(t.Context(), b, mutator.ApplyManagedStateEnv()) + require.NoError(t, diags.Error()) + require.NotNil(t, b.Config.Bundle.Deployment.ManagedState) + assert.True(t, *b.Config.Bundle.Deployment.ManagedState) } -//go:fix inline -func boolPtr(v bool) *bool { return new(v) } - -func TestApplyManagedStateEnvSetsFromEnvVar(t *testing.T) { - cases := []struct { - value string - want bool - }{ - {"true", true}, - {"TRUE", true}, - {"1", true}, - {"yes", true}, - {"on", true}, - {"false", false}, - {"0", false}, - {"no", false}, - {"off", false}, - } - for _, tc := range cases { - t.Run(tc.value, func(t *testing.T) { +func TestApplyManagedStateEnvOtherValues(t *testing.T) { + for _, v := range []string{"false", "1", "yes", "on", "TRUE", "garbage", ""} { + t.Run(v, func(t *testing.T) { testutil.CleanupEnvironment(t) - t.Setenv("DATABRICKS_BUNDLE_MANAGED_STATE", tc.value) - b := makeBundle(nil) + t.Setenv("DATABRICKS_BUNDLE_MANAGED_STATE", v) + b := &bundle.Bundle{} diags := bundle.Apply(t.Context(), b, mutator.ApplyManagedStateEnv()) require.NoError(t, diags.Error()) - require.NotNil(t, b.Config.Bundle.Deployment.ManagedState) - assert.Equal(t, tc.want, *b.Config.Bundle.Deployment.ManagedState) + assert.Nil(t, b.Config.Bundle.Deployment.ManagedState) }) } } func TestApplyManagedStateEnvUnset(t *testing.T) { testutil.CleanupEnvironment(t) - b := makeBundle(nil) + b := &bundle.Bundle{} diags := bundle.Apply(t.Context(), b, mutator.ApplyManagedStateEnv()) require.NoError(t, diags.Error()) assert.Nil(t, b.Config.Bundle.Deployment.ManagedState) } -func TestApplyManagedStateEnvGarbageValueFallsBackToFalse(t *testing.T) { +func TestApplyManagedStateEnvConfigTakesPriority(t *testing.T) { testutil.CleanupEnvironment(t) - t.Setenv("DATABRICKS_BUNDLE_MANAGED_STATE", "garbage") - b := makeBundle(nil) + t.Setenv("DATABRICKS_BUNDLE_MANAGED_STATE", "true") + disabled := false + b := &bundle.Bundle{} + b.Config.Bundle.Deployment.ManagedState = &disabled diags := bundle.Apply(t.Context(), b, mutator.ApplyManagedStateEnv()) require.NoError(t, diags.Error()) - // GetBool treats unrecognised values as false (ok=true), so the field is set. - require.NotNil(t, b.Config.Bundle.Deployment.ManagedState) assert.False(t, *b.Config.Bundle.Deployment.ManagedState) } - -func TestApplyManagedStateEnvConfigTakesPriority(t *testing.T) { - cases := []struct { - name string - configValue bool - envValue string - }{ - {"config true, env false", true, "false"}, - {"config false, env true", false, "true"}, - } - for _, tc := range cases { - t.Run(tc.name, func(t *testing.T) { - testutil.CleanupEnvironment(t) - t.Setenv("DATABRICKS_BUNDLE_MANAGED_STATE", tc.envValue) - b := makeBundle(new(tc.configValue)) - diags := bundle.Apply(t.Context(), b, mutator.ApplyManagedStateEnv()) - require.NoError(t, diags.Error()) - require.NotNil(t, b.Config.Bundle.Deployment.ManagedState) - assert.Equal(t, tc.configValue, *b.Config.Bundle.Deployment.ManagedState) - }) - } -} - -// Verify the config field is accessible at the expected path in databricks.yml. -func TestApplyManagedStateEnvConfigPath(t *testing.T) { - b := &bundle.Bundle{ - Config: config.Root{ - Bundle: config.Bundle{ - Deployment: config.Deployment{ - ManagedState: new(true), - }, - }, - }, - } - assert.True(t, *b.Config.Bundle.Deployment.ManagedState) -} From 395290e4ddf114da0123c755b9065f2ea9393c24 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Sun, 31 May 2026 23:50:03 +0200 Subject: [PATCH 04/10] bundle: drop ApplyManagedStateEnv mutator; follow engine pattern MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No mutator is needed — DATABRICKS_BUNDLE_ENGINE uses the same config+env combination but resolves on demand via ResolveEngineSetting rather than writing into the config tree. Managed state will follow the same pattern: the first consumer PR adds an IsManagedState(ctx, b) resolver. This PR establishes only the config field and the env var constant. Co-authored-by: Shreyas Goenka --- .../config/mutator/apply_managed_state_env.go | 36 ------------- .../mutator/apply_managed_state_env_test.go | 53 ------------------- bundle/config/mutator/mutator.go | 1 - 3 files changed, 90 deletions(-) delete mode 100644 bundle/config/mutator/apply_managed_state_env.go delete mode 100644 bundle/config/mutator/apply_managed_state_env_test.go diff --git a/bundle/config/mutator/apply_managed_state_env.go b/bundle/config/mutator/apply_managed_state_env.go deleted file mode 100644 index 998774be8e..0000000000 --- a/bundle/config/mutator/apply_managed_state_env.go +++ /dev/null @@ -1,36 +0,0 @@ -package mutator - -import ( - "context" - - "github.com/databricks/cli/bundle" - bundleenv "github.com/databricks/cli/bundle/env" - "github.com/databricks/cli/libs/diag" - envlib "github.com/databricks/cli/libs/env" -) - -type applyManagedStateEnv struct{} - -// ApplyManagedStateEnv reads DATABRICKS_BUNDLE_MANAGED_STATE and writes it -// into bundle.deployment.managed_state when the field is not already set in -// configuration. Configuration takes priority over the environment variable. -// Only the value "true" enables managed state; any other value is ignored. -func ApplyManagedStateEnv() bundle.Mutator { - return &applyManagedStateEnv{} -} - -func (m *applyManagedStateEnv) Name() string { - return "ApplyManagedStateEnv" -} - -func (m *applyManagedStateEnv) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnostics { - if b.Config.Bundle.Deployment.ManagedState != nil { - return nil - } - if envlib.Get(ctx, bundleenv.ManagedStateVariable) != "true" { - return nil - } - enabled := true - b.Config.Bundle.Deployment.ManagedState = &enabled - return nil -} diff --git a/bundle/config/mutator/apply_managed_state_env_test.go b/bundle/config/mutator/apply_managed_state_env_test.go deleted file mode 100644 index 818e9afe1e..0000000000 --- a/bundle/config/mutator/apply_managed_state_env_test.go +++ /dev/null @@ -1,53 +0,0 @@ -package mutator_test - -import ( - "testing" - - "github.com/databricks/cli/bundle" - "github.com/databricks/cli/bundle/config/mutator" - "github.com/databricks/cli/internal/testutil" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestApplyManagedStateEnvTrue(t *testing.T) { - testutil.CleanupEnvironment(t) - t.Setenv("DATABRICKS_BUNDLE_MANAGED_STATE", "true") - b := &bundle.Bundle{} - diags := bundle.Apply(t.Context(), b, mutator.ApplyManagedStateEnv()) - require.NoError(t, diags.Error()) - require.NotNil(t, b.Config.Bundle.Deployment.ManagedState) - assert.True(t, *b.Config.Bundle.Deployment.ManagedState) -} - -func TestApplyManagedStateEnvOtherValues(t *testing.T) { - for _, v := range []string{"false", "1", "yes", "on", "TRUE", "garbage", ""} { - t.Run(v, func(t *testing.T) { - testutil.CleanupEnvironment(t) - t.Setenv("DATABRICKS_BUNDLE_MANAGED_STATE", v) - b := &bundle.Bundle{} - diags := bundle.Apply(t.Context(), b, mutator.ApplyManagedStateEnv()) - require.NoError(t, diags.Error()) - assert.Nil(t, b.Config.Bundle.Deployment.ManagedState) - }) - } -} - -func TestApplyManagedStateEnvUnset(t *testing.T) { - testutil.CleanupEnvironment(t) - b := &bundle.Bundle{} - diags := bundle.Apply(t.Context(), b, mutator.ApplyManagedStateEnv()) - require.NoError(t, diags.Error()) - assert.Nil(t, b.Config.Bundle.Deployment.ManagedState) -} - -func TestApplyManagedStateEnvConfigTakesPriority(t *testing.T) { - testutil.CleanupEnvironment(t) - t.Setenv("DATABRICKS_BUNDLE_MANAGED_STATE", "true") - disabled := false - b := &bundle.Bundle{} - b.Config.Bundle.Deployment.ManagedState = &disabled - diags := bundle.Apply(t.Context(), b, mutator.ApplyManagedStateEnv()) - require.NoError(t, diags.Error()) - assert.False(t, *b.Config.Bundle.Deployment.ManagedState) -} diff --git a/bundle/config/mutator/mutator.go b/bundle/config/mutator/mutator.go index 896ca30e30..a00488a50f 100644 --- a/bundle/config/mutator/mutator.go +++ b/bundle/config/mutator/mutator.go @@ -13,7 +13,6 @@ import ( func DefaultMutators(ctx context.Context, b *bundle.Bundle) { bundle.ApplySeqContext(ctx, b, loader.EntryPoint(), - ApplyManagedStateEnv(), // Execute preinit script before processing includes. // It needs to be done before processing configuration files to allow From 4eec38ab5d012e47db83be6a60d0a58e321a1db9 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Sun, 31 May 2026 23:53:26 +0200 Subject: [PATCH 05/10] bundle: add IsManagedState(ctx, b) resolution function Mirrors the IsDirect() pattern from the engine: a single function that checks bundle.deployment.managed_state first and falls back to the DATABRICKS_BUNDLE_MANAGED_STATE env var. Lives in the bundle package, which already imports both bundle/env and bundle/config. Co-authored-by: Shreyas Goenka --- bundle/managed_state.go | 19 ++++++++++++++ bundle/managed_state_test.go | 50 ++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 bundle/managed_state.go create mode 100644 bundle/managed_state_test.go diff --git a/bundle/managed_state.go b/bundle/managed_state.go new file mode 100644 index 0000000000..c7ee1c603c --- /dev/null +++ b/bundle/managed_state.go @@ -0,0 +1,19 @@ +package bundle + +import ( + "context" + + bundleenv "github.com/databricks/cli/bundle/env" + envlib "github.com/databricks/cli/libs/env" +) + +// IsManagedState reports whether the bundle is opted into the deployment +// metadata service (DMS) for locking and resource-state management. +// Configuration takes priority over the DATABRICKS_BUNDLE_MANAGED_STATE +// environment variable. +func IsManagedState(ctx context.Context, b *Bundle) bool { + if b.Config.Bundle.Deployment.ManagedState != nil { + return *b.Config.Bundle.Deployment.ManagedState + } + return envlib.Get(ctx, bundleenv.ManagedStateVariable) == "true" +} diff --git a/bundle/managed_state_test.go b/bundle/managed_state_test.go new file mode 100644 index 0000000000..0c861dad0f --- /dev/null +++ b/bundle/managed_state_test.go @@ -0,0 +1,50 @@ +package bundle_test + +import ( + "testing" + + "github.com/databricks/cli/bundle" + "github.com/databricks/cli/bundle/config" + "github.com/databricks/cli/internal/testutil" + "github.com/stretchr/testify/assert" +) + +func TestIsManagedStateEnvVar(t *testing.T) { + testutil.CleanupEnvironment(t) + t.Setenv("DATABRICKS_BUNDLE_MANAGED_STATE", "true") + b := &bundle.Bundle{} + assert.True(t, bundle.IsManagedState(t.Context(), b)) +} + +func TestIsManagedStateEnvVarOtherValues(t *testing.T) { + for _, v := range []string{"false", "1", "yes", "on", "TRUE", "garbage", ""} { + t.Run(v, func(t *testing.T) { + testutil.CleanupEnvironment(t) + t.Setenv("DATABRICKS_BUNDLE_MANAGED_STATE", v) + b := &bundle.Bundle{} + assert.False(t, bundle.IsManagedState(t.Context(), b)) + }) + } +} + +func TestIsManagedStateConfigTakesPriority(t *testing.T) { + testutil.CleanupEnvironment(t) + t.Setenv("DATABRICKS_BUNDLE_MANAGED_STATE", "true") + disabled := false + b := &bundle.Bundle{ + Config: config.Root{ + Bundle: config.Bundle{ + Deployment: config.Deployment{ + ManagedState: &disabled, + }, + }, + }, + } + assert.False(t, bundle.IsManagedState(t.Context(), b)) +} + +func TestIsManagedStateUnset(t *testing.T) { + testutil.CleanupEnvironment(t) + b := &bundle.Bundle{} + assert.False(t, bundle.IsManagedState(t.Context(), b)) +} From 9fec699f6495f6aad816700e3c87e69b74ca9365 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Sun, 31 May 2026 23:59:04 +0200 Subject: [PATCH 06/10] bundle: simplify comments, add config=true test case Remove references to "historical filesystem-based behavior" and trim comment wording. Add TestIsManagedStateConfigTrue to cover the config-field=true path. Co-authored-by: Shreyas Goenka --- bundle/config/deployment.go | 3 +-- bundle/env/deployment_metadata.go | 7 ++----- bundle/managed_state.go | 5 ++--- bundle/managed_state_test.go | 15 +++++++++++++++ 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/bundle/config/deployment.go b/bundle/config/deployment.go index 5820f14674..edb7c30dd4 100644 --- a/bundle/config/deployment.go +++ b/bundle/config/deployment.go @@ -9,8 +9,7 @@ type Deployment struct { Lock Lock `json:"lock,omitempty"` // ManagedState opts the bundle into the deployment metadata service (DMS) - // for locking and resource-state management. Defaults to false (historical - // filesystem-based behavior). Can also be set with the + // for locking and resource-state management. Can also be set with the // DATABRICKS_BUNDLE_MANAGED_STATE environment variable; configuration takes // priority over the environment variable. ManagedState *bool `json:"managed_state,omitempty"` diff --git a/bundle/env/deployment_metadata.go b/bundle/env/deployment_metadata.go index 3ffca624a9..24d99e04d5 100644 --- a/bundle/env/deployment_metadata.go +++ b/bundle/env/deployment_metadata.go @@ -1,9 +1,6 @@ package env // ManagedStateVariable opts a bundle into the deployment metadata service -// (DMS) for locking and resource-state management. Defaults to the historical -// filesystem-based behavior when unset. -// -// The variable is treated as a boolean and accepts the usual spellings: -// "true"/"false", "1"/"0", "yes"/"no", "on"/"off" (case-insensitive). +// (DMS) for locking and resource-state management. Only the exact value +// "true" enables managed state; any other value is treated as unset. const ManagedStateVariable = "DATABRICKS_BUNDLE_MANAGED_STATE" diff --git a/bundle/managed_state.go b/bundle/managed_state.go index c7ee1c603c..64501aeb55 100644 --- a/bundle/managed_state.go +++ b/bundle/managed_state.go @@ -8,9 +8,8 @@ import ( ) // IsManagedState reports whether the bundle is opted into the deployment -// metadata service (DMS) for locking and resource-state management. -// Configuration takes priority over the DATABRICKS_BUNDLE_MANAGED_STATE -// environment variable. +// metadata service (DMS). Configuration takes priority over the +// DATABRICKS_BUNDLE_MANAGED_STATE environment variable. func IsManagedState(ctx context.Context, b *Bundle) bool { if b.Config.Bundle.Deployment.ManagedState != nil { return *b.Config.Bundle.Deployment.ManagedState diff --git a/bundle/managed_state_test.go b/bundle/managed_state_test.go index 0c861dad0f..25eb7b55f5 100644 --- a/bundle/managed_state_test.go +++ b/bundle/managed_state_test.go @@ -27,6 +27,21 @@ func TestIsManagedStateEnvVarOtherValues(t *testing.T) { } } +func TestIsManagedStateConfigTrue(t *testing.T) { + testutil.CleanupEnvironment(t) + enabled := true + b := &bundle.Bundle{ + Config: config.Root{ + Bundle: config.Bundle{ + Deployment: config.Deployment{ + ManagedState: &enabled, + }, + }, + }, + } + assert.True(t, bundle.IsManagedState(t.Context(), b)) +} + func TestIsManagedStateConfigTakesPriority(t *testing.T) { testutil.CleanupEnvironment(t) t.Setenv("DATABRICKS_BUNDLE_MANAGED_STATE", "true") From 5c60dfcb7b6704317ae4f0d1509012bde8ebe400 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Mon, 1 Jun 2026 00:02:15 +0200 Subject: [PATCH 07/10] bundle: regenerate schema for managed_state field Co-authored-by: Shreyas Goenka --- bundle/schema/jsonschema.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bundle/schema/jsonschema.json b/bundle/schema/jsonschema.json index c2026fc43b..4e22966180 100644 --- a/bundle/schema/jsonschema.json +++ b/bundle/schema/jsonschema.json @@ -2410,6 +2410,9 @@ "lock": { "description": "The deployment lock attributes.", "$ref": "#/$defs/github.com/databricks/cli/bundle/config.Lock" + }, + "managed_state": { + "$ref": "#/$defs/bool" } }, "additionalProperties": false From 17c41664b83d2387b6a8e62390540fca290fed38 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Mon, 1 Jun 2026 13:55:33 +0200 Subject: [PATCH 08/10] bundle: add direct_with_history engine type for deployment history MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds engine: direct_with_history as a new enum value for bundle.engine. It is a superset of direct — IsDirect() returns true for both — and opts the bundle into the deployment metadata service (DMS) for deployment history tracking. The existing DATABRICKS_BUNDLE_ENGINE env var is the single control point; no separate field or env var is needed. IsManagedState(ctx, b) is the internal API for checking whether DMS is active. It checks bundle.engine first and falls back to the env var, matching the precedent set by ResolveEngineSetting. Co-authored-by: Shreyas Goenka --- bundle/config/deployment.go | 6 +----- bundle/config/engine/engine.go | 20 +++++++++++++++----- bundle/env/deployment_metadata.go | 6 ------ bundle/internal/schema/annotations.yml | 7 ++++++- bundle/managed_state.go | 17 +++++++++-------- bundle/managed_state_test.go | 23 +++++++++-------------- bundle/schema/jsonschema.json | 8 +++----- 7 files changed, 43 insertions(+), 44 deletions(-) delete mode 100644 bundle/env/deployment_metadata.go diff --git a/bundle/config/deployment.go b/bundle/config/deployment.go index edb7c30dd4..876debbdc6 100644 --- a/bundle/config/deployment.go +++ b/bundle/config/deployment.go @@ -8,9 +8,5 @@ type Deployment struct { // Lock configures locking behavior on deployment. Lock Lock `json:"lock,omitempty"` - // ManagedState opts the bundle into the deployment metadata service (DMS) - // for locking and resource-state management. Can also be set with the - // DATABRICKS_BUNDLE_MANAGED_STATE environment variable; configuration takes - // priority over the environment variable. - ManagedState *bool `json:"managed_state,omitempty"` + } diff --git a/bundle/config/engine/engine.go b/bundle/config/engine/engine.go index c2c251e8f9..70eb852d83 100644 --- a/bundle/config/engine/engine.go +++ b/bundle/config/engine/engine.go @@ -12,9 +12,10 @@ const EnvVar = "DATABRICKS_BUNDLE_ENGINE" type EngineType string const ( - EngineDirect EngineType = "direct" - EngineTerraform EngineType = "terraform" - EngineNotSet EngineType = "" + EngineDirect EngineType = "direct" + EngineDirectWithHistory EngineType = "direct_with_history" + EngineTerraform EngineType = "terraform" + EngineNotSet EngineType = "" ) // Default is used for new bundles if user has not set the value @@ -29,6 +30,8 @@ func Parse(engine string) (EngineType, bool) { return EngineTerraform, true case "direct": return EngineDirect, true + case "direct_with_history": + return EngineDirectWithHistory, true default: return EngineNotSet, false } @@ -39,7 +42,7 @@ func FromEnv(ctx context.Context) (EngineType, error) { value := env.Get(ctx, EnvVar) engine, ok := Parse(value) if !ok { - return EngineNotSet, fmt.Errorf("unexpected setting for %s=%#v (expected 'terraform' or 'direct')", EnvVar, value) + return EngineNotSet, fmt.Errorf("unexpected setting for %s=%#v (expected 'terraform', 'direct', or 'direct_with_history')", EnvVar, value) } return engine, nil } @@ -58,6 +61,13 @@ func (e EngineType) ThisOrDefault() EngineType { return e } +// IsDirect reports whether the engine is a direct engine (with or without history). func (e EngineType) IsDirect() bool { - return e.ThisOrDefault() == EngineDirect + t := e.ThisOrDefault() + return t == EngineDirect || t == EngineDirectWithHistory +} + +// IsDirectWithHistory reports whether the engine is direct with deployment history enabled. +func (e EngineType) IsDirectWithHistory() bool { + return e.ThisOrDefault() == EngineDirectWithHistory } diff --git a/bundle/env/deployment_metadata.go b/bundle/env/deployment_metadata.go deleted file mode 100644 index 24d99e04d5..0000000000 --- a/bundle/env/deployment_metadata.go +++ /dev/null @@ -1,6 +0,0 @@ -package env - -// ManagedStateVariable opts a bundle into the deployment metadata service -// (DMS) for locking and resource-state management. Only the exact value -// "true" enables managed state; any other value is treated as unset. -const ManagedStateVariable = "DATABRICKS_BUNDLE_MANAGED_STATE" diff --git a/bundle/internal/schema/annotations.yml b/bundle/internal/schema/annotations.yml index 6a1070ddcd..933ed9342a 100644 --- a/bundle/internal/schema/annotations.yml +++ b/bundle/internal/schema/annotations.yml @@ -44,7 +44,7 @@ github.com/databricks/cli/bundle/config.Bundle: The definition of the bundle deployment. For supported attributes see [\_](/dev-tools/bundles/deployment-modes.md). "engine": "description": |- - The deployment engine to use. Valid values are `terraform` and `direct`. Takes priority over `DATABRICKS_BUNDLE_ENGINE` environment variable. Default is "terraform". + The deployment engine to use. Valid values are `terraform`, `direct`, and `direct_with_history`. Takes priority over `DATABRICKS_BUNDLE_ENGINE` environment variable. Default is "terraform". "git": "description": |- The Git version control details that are associated with your bundle. @@ -63,6 +63,9 @@ github.com/databricks/cli/bundle/config.Deployment: "lock": "description": |- The deployment lock attributes. + "managed_state": + "description": |- + PLACEHOLDER github.com/databricks/cli/bundle/config.Experimental: "pydabs": "description": |- @@ -491,6 +494,8 @@ github.com/databricks/cli/bundle/config/engine.EngineType: terraform - |- direct + - |- + direct_with_history github.com/databricks/cli/bundle/config/resources.Alert: "create_time": "description": |- diff --git a/bundle/managed_state.go b/bundle/managed_state.go index 64501aeb55..7688116b79 100644 --- a/bundle/managed_state.go +++ b/bundle/managed_state.go @@ -3,16 +3,17 @@ package bundle import ( "context" - bundleenv "github.com/databricks/cli/bundle/env" - envlib "github.com/databricks/cli/libs/env" + "github.com/databricks/cli/bundle/config/engine" ) -// IsManagedState reports whether the bundle is opted into the deployment -// metadata service (DMS). Configuration takes priority over the -// DATABRICKS_BUNDLE_MANAGED_STATE environment variable. +// IsManagedState reports whether the bundle uses the direct engine with +// deployment history enabled (engine: direct_with_history). +// Configuration takes priority over the DATABRICKS_BUNDLE_ENGINE environment variable. func IsManagedState(ctx context.Context, b *Bundle) bool { - if b.Config.Bundle.Deployment.ManagedState != nil { - return *b.Config.Bundle.Deployment.ManagedState + engineType := b.Config.Bundle.Engine + if engineType == engine.EngineNotSet { + envEngine, _ := engine.FromEnv(ctx) + engineType = envEngine } - return envlib.Get(ctx, bundleenv.ManagedStateVariable) == "true" + return engineType.IsDirectWithHistory() } diff --git a/bundle/managed_state_test.go b/bundle/managed_state_test.go index 25eb7b55f5..88ee609cd6 100644 --- a/bundle/managed_state_test.go +++ b/bundle/managed_state_test.go @@ -5,37 +5,35 @@ import ( "github.com/databricks/cli/bundle" "github.com/databricks/cli/bundle/config" + "github.com/databricks/cli/bundle/config/engine" "github.com/databricks/cli/internal/testutil" "github.com/stretchr/testify/assert" ) func TestIsManagedStateEnvVar(t *testing.T) { testutil.CleanupEnvironment(t) - t.Setenv("DATABRICKS_BUNDLE_MANAGED_STATE", "true") + t.Setenv("DATABRICKS_BUNDLE_ENGINE", "direct_with_history") b := &bundle.Bundle{} assert.True(t, bundle.IsManagedState(t.Context(), b)) } -func TestIsManagedStateEnvVarOtherValues(t *testing.T) { - for _, v := range []string{"false", "1", "yes", "on", "TRUE", "garbage", ""} { +func TestIsManagedStateOtherEngines(t *testing.T) { + for _, v := range []string{"direct", "terraform", ""} { t.Run(v, func(t *testing.T) { testutil.CleanupEnvironment(t) - t.Setenv("DATABRICKS_BUNDLE_MANAGED_STATE", v) + t.Setenv("DATABRICKS_BUNDLE_ENGINE", v) b := &bundle.Bundle{} assert.False(t, bundle.IsManagedState(t.Context(), b)) }) } } -func TestIsManagedStateConfigTrue(t *testing.T) { +func TestIsManagedStateConfig(t *testing.T) { testutil.CleanupEnvironment(t) - enabled := true b := &bundle.Bundle{ Config: config.Root{ Bundle: config.Bundle{ - Deployment: config.Deployment{ - ManagedState: &enabled, - }, + Engine: engine.EngineDirectWithHistory, }, }, } @@ -44,14 +42,11 @@ func TestIsManagedStateConfigTrue(t *testing.T) { func TestIsManagedStateConfigTakesPriority(t *testing.T) { testutil.CleanupEnvironment(t) - t.Setenv("DATABRICKS_BUNDLE_MANAGED_STATE", "true") - disabled := false + t.Setenv("DATABRICKS_BUNDLE_ENGINE", "direct_with_history") b := &bundle.Bundle{ Config: config.Root{ Bundle: config.Bundle{ - Deployment: config.Deployment{ - ManagedState: &disabled, - }, + Engine: engine.EngineDirect, }, }, } diff --git a/bundle/schema/jsonschema.json b/bundle/schema/jsonschema.json index 4e22966180..afc68033eb 100644 --- a/bundle/schema/jsonschema.json +++ b/bundle/schema/jsonschema.json @@ -65,7 +65,8 @@ "type": "string", "enum": [ "terraform", - "direct" + "direct", + "direct_with_history" ] }, { @@ -2367,7 +2368,7 @@ "markdownDescription": "The definition of the bundle deployment. For supported attributes see [link](https://docs.databricks.com/dev-tools/bundles/deployment-modes.html)." }, "engine": { - "description": "The deployment engine to use. Valid values are `terraform` and `direct`. Takes priority over `DATABRICKS_BUNDLE_ENGINE` environment variable. Default is \"terraform\".", + "description": "The deployment engine to use. Valid values are `terraform`, `direct`, and `direct_with_history`. Takes priority over `DATABRICKS_BUNDLE_ENGINE` environment variable. Default is \"terraform\".", "$ref": "#/$defs/github.com/databricks/cli/bundle/config/engine.EngineType" }, "git": { @@ -2410,9 +2411,6 @@ "lock": { "description": "The deployment lock attributes.", "$ref": "#/$defs/github.com/databricks/cli/bundle/config.Lock" - }, - "managed_state": { - "$ref": "#/$defs/bool" } }, "additionalProperties": false From c1155cd999f3394949a7cc1ef5d7405770469ad8 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Mon, 1 Jun 2026 13:58:41 +0200 Subject: [PATCH 09/10] bundle: rename IsManagedState -> IsDirectWithHistory Co-authored-by: Shreyas Goenka --- ...anaged_state.go => direct_with_history.go} | 4 ++-- ...te_test.go => direct_with_history_test.go} | 20 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) rename bundle/{managed_state.go => direct_with_history.go} (75%) rename bundle/{managed_state_test.go => direct_with_history_test.go} (63%) diff --git a/bundle/managed_state.go b/bundle/direct_with_history.go similarity index 75% rename from bundle/managed_state.go rename to bundle/direct_with_history.go index 7688116b79..a708183a69 100644 --- a/bundle/managed_state.go +++ b/bundle/direct_with_history.go @@ -6,10 +6,10 @@ import ( "github.com/databricks/cli/bundle/config/engine" ) -// IsManagedState reports whether the bundle uses the direct engine with +// IsDirectWithHistory reports whether the bundle uses the direct engine with // deployment history enabled (engine: direct_with_history). // Configuration takes priority over the DATABRICKS_BUNDLE_ENGINE environment variable. -func IsManagedState(ctx context.Context, b *Bundle) bool { +func IsDirectWithHistory(ctx context.Context, b *Bundle) bool { engineType := b.Config.Bundle.Engine if engineType == engine.EngineNotSet { envEngine, _ := engine.FromEnv(ctx) diff --git a/bundle/managed_state_test.go b/bundle/direct_with_history_test.go similarity index 63% rename from bundle/managed_state_test.go rename to bundle/direct_with_history_test.go index 88ee609cd6..448e91b4b3 100644 --- a/bundle/managed_state_test.go +++ b/bundle/direct_with_history_test.go @@ -10,25 +10,25 @@ import ( "github.com/stretchr/testify/assert" ) -func TestIsManagedStateEnvVar(t *testing.T) { +func TestIsDirectWithHistoryEnvVar(t *testing.T) { testutil.CleanupEnvironment(t) t.Setenv("DATABRICKS_BUNDLE_ENGINE", "direct_with_history") b := &bundle.Bundle{} - assert.True(t, bundle.IsManagedState(t.Context(), b)) + assert.True(t, bundle.IsDirectWithHistory(t.Context(), b)) } -func TestIsManagedStateOtherEngines(t *testing.T) { +func TestIsDirectWithHistoryOtherEngines(t *testing.T) { for _, v := range []string{"direct", "terraform", ""} { t.Run(v, func(t *testing.T) { testutil.CleanupEnvironment(t) t.Setenv("DATABRICKS_BUNDLE_ENGINE", v) b := &bundle.Bundle{} - assert.False(t, bundle.IsManagedState(t.Context(), b)) + assert.False(t, bundle.IsDirectWithHistory(t.Context(), b)) }) } } -func TestIsManagedStateConfig(t *testing.T) { +func TestIsDirectWithHistoryConfig(t *testing.T) { testutil.CleanupEnvironment(t) b := &bundle.Bundle{ Config: config.Root{ @@ -37,10 +37,10 @@ func TestIsManagedStateConfig(t *testing.T) { }, }, } - assert.True(t, bundle.IsManagedState(t.Context(), b)) + assert.True(t, bundle.IsDirectWithHistory(t.Context(), b)) } -func TestIsManagedStateConfigTakesPriority(t *testing.T) { +func TestIsDirectWithHistoryConfigTakesPriority(t *testing.T) { testutil.CleanupEnvironment(t) t.Setenv("DATABRICKS_BUNDLE_ENGINE", "direct_with_history") b := &bundle.Bundle{ @@ -50,11 +50,11 @@ func TestIsManagedStateConfigTakesPriority(t *testing.T) { }, }, } - assert.False(t, bundle.IsManagedState(t.Context(), b)) + assert.False(t, bundle.IsDirectWithHistory(t.Context(), b)) } -func TestIsManagedStateUnset(t *testing.T) { +func TestIsDirectWithHistoryUnset(t *testing.T) { testutil.CleanupEnvironment(t) b := &bundle.Bundle{} - assert.False(t, bundle.IsManagedState(t.Context(), b)) + assert.False(t, bundle.IsDirectWithHistory(t.Context(), b)) } From 5d3f2808ccda09f439a46fc71b1a81f53e011efa Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Mon, 1 Jun 2026 14:01:26 +0200 Subject: [PATCH 10/10] bundle: drop stray blank lines in deployment.go Leftover from removing the managed_state field; the file now matches main. Co-authored-by: Shreyas Goenka --- bundle/config/deployment.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/bundle/config/deployment.go b/bundle/config/deployment.go index 876debbdc6..b7efb4456f 100644 --- a/bundle/config/deployment.go +++ b/bundle/config/deployment.go @@ -7,6 +7,4 @@ type Deployment struct { // Lock configures locking behavior on deployment. Lock Lock `json:"lock,omitempty"` - - }