Skip to content

bundle: add managed_state deployment config field and env var support#5365

Draft
shreyas-goenka wants to merge 7 commits into
mainfrom
shreyas-goenka/cli-managed-state-flag
Draft

bundle: add managed_state deployment config field and env var support#5365
shreyas-goenka wants to merge 7 commits into
mainfrom
shreyas-goenka/cli-managed-state-flag

Conversation

@shreyas-goenka
Copy link
Copy Markdown
Contributor

@shreyas-goenka shreyas-goenka commented May 28, 2026

Adds bundle.deployment.managed_state to opt a bundle into the deployment metadata service (DMS) for locking and resource-state management. The field can be set in two ways:

# databricks.yml
bundle:
  deployment:
    managed_state: true
DATABRICKS_BUNDLE_MANAGED_STATE=true databricks bundle deploy

Config takes priority over the env var (same precedent as bundle.engine / DATABRICKS_BUNDLE_ENGINE). A new ApplyManagedStateEnv mutator, registered in DefaultMutators after EntryPoint, bridges the env var into the config field. After DefaultMutators runs, b.Config.Bundle.Deployment.ManagedState is the single source of truth for downstream consumers.

This is a foundation PR with no consumers yet — lock impl, state read, and operation reporting follow separately.

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
@eng-dev-ecosystem-bot
Copy link
Copy Markdown
Collaborator

eng-dev-ecosystem-bot commented May 28, 2026

Commit: 5c60dfc

Run: 26725754418

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 <shreyas.goenka@databricks.com>
@shreyas-goenka shreyas-goenka changed the title bundle/env: add DATABRICKS_BUNDLE_MANAGED_STATE flag helper bundle: add managed_state deployment config field and env var support May 31, 2026
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 <shreyas.goenka@databricks.com>
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 <shreyas.goenka@databricks.com>
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 <shreyas.goenka@databricks.com>
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 <shreyas.goenka@databricks.com>
Co-authored-by: Shreyas Goenka <shreyas.goenka@databricks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants