Skip to content

Commit a5ab0f3

Browse files
denikclaude
andauthored
Remove SkipEngineEnvVar from ProcessOptions (#4759)
## Changes - Remove `SkipEngineEnvVar` field from `ProcessOptions` in `process.go` - In `migrate.go`, clear `DATABRICKS_BUNDLE_ENGINE` in the context via `env.Set(ctx, engine.EnvVar, "")` before calling `ProcessBundleRet`, achieving the same effect ## Why Simplify env var handling for #4749 ## Test plan Existing tests. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 891db0f commit a5ab0f3

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

cmd/bundle/deployment/migrate.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ import (
99
"os/exec"
1010
"strings"
1111

12+
"github.com/databricks/cli/bundle/config/engine"
1213
"github.com/databricks/cli/bundle/deploy/terraform"
1314
"github.com/databricks/cli/bundle/deployplan"
1415
"github.com/databricks/cli/bundle/direct"
1516
"github.com/databricks/cli/bundle/direct/dstate"
1617
"github.com/databricks/cli/cmd/bundle/utils"
1718
"github.com/databricks/cli/cmd/root"
1819
"github.com/databricks/cli/libs/cmdio"
20+
"github.com/databricks/cli/libs/env"
1921
"github.com/databricks/cli/libs/logdiag"
2022
"github.com/databricks/cli/libs/shellquote"
2123
"github.com/databricks/cli/libs/structs/structaccess"
@@ -140,9 +142,12 @@ WARNING: Both direct deployment engine and this command are experimental and not
140142
cmd.RunE = func(cmd *cobra.Command, args []string) error {
141143
extraArgs, extraArgsStr := getCommonArgs(cmd)
142144

145+
// Clear the engine env var so migrate always uses terraform engine to read existing state,
146+
// regardless of what the user may have set in their environment.
147+
cmd.SetContext(env.Set(cmd.Context(), engine.EnvVar, ""))
148+
143149
opts := utils.ProcessOptions{
144-
SkipEngineEnvVar: true,
145-
AlwaysPull: true,
150+
AlwaysPull: true,
146151
// Same options as regular deploy, to ensure bundle config is in the same state
147152
FastValidate: true,
148153
Build: true,

cmd/bundle/utils/process.go

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ type ProcessOptions struct {
5959
// If true, configure outputHandler for phases.Deploy
6060
Verbose bool
6161

62-
// If true, do not read DATABRICKS_BUNDLE_ENGINE env var (for migrate command, which ignores this env var)
63-
SkipEngineEnvVar bool
64-
6562
// If true, call corresponding phase:
6663
FastValidate bool
6764
Validate bool
@@ -94,13 +91,9 @@ func ProcessBundleRet(cmd *cobra.Command, opts ProcessOptions) (*bundle.Bundle,
9491
cmd.SetContext(ctx)
9592
}
9693

97-
requiredEngine := engine.EngineNotSet
98-
99-
if !opts.SkipEngineEnvVar {
100-
requiredEngine, err = engine.FromEnv(ctx)
101-
if err != nil {
102-
return nil, nil, err
103-
}
94+
requiredEngine, err := engine.FromEnv(ctx)
95+
if err != nil {
96+
return nil, nil, err
10497
}
10598

10699
// Load bundle config and apply target

0 commit comments

Comments
 (0)