Skip to content

Pass DATABRICKS_CLI_PATH and resolve the platform-specific CLI binary#1910

Merged
rugpanov merged 2 commits into
mainfrom
fix/databricks-cli-path-windows
Jun 16, 2026
Merged

Pass DATABRICKS_CLI_PATH and resolve the platform-specific CLI binary#1910
rugpanov merged 2 commits into
mainfrom
fix/databricks-cli-path-windows

Conversation

@rugpanov

Copy link
Copy Markdown
Contributor

Why

  • On Windows, databricks bundle deploys fail with databricks CLI not found because the SDK / Terraform provider can't locate the bundled CLI when running in a subprocess.
  • The path that was forwarded was extensionless (bin/databricks), but the bundled Windows binary is databricks.exe. The Go SDK / Terraform provider do a literal file lookup and do not auto-append .exe the way Windows' CreateProcess does — so the lookup fails.
  • The legacy .databricks/project.json persisted the bundled CLI path (databricksPath), and AuthProvider.fromJSON preferred it over the freshly resolved path. That snapshot is version-pinned and, on Windows, was stored without .exe, so it overrode the corrected path during legacy→bundle migration.

This builds on #1903 (which adds the DATABRICKS_CLI_PATH env var) by also making the path it forwards correct on Windows and not letting a stale persisted path win.

What

  • Forward the resolved CLI path to subprocesses via the DATABRICKS_CLI_PATH env var so they don't fall back to a PATH search (DatabricksCliAuthProvider.toEnv).
  • Make CliWrapper.cliPath return the platform-specific binary name: databricks.exe on win32, databricks elsewhere.
  • In AuthProvider.fromJSON, always use the freshly resolved bundled CLI path and ignore the persisted databricksPath — it's an extension-managed, version-pinned value that is stale after any upgrade. (fromSdkConfig is intentionally left alone, since its databricksCliPath comes live from the user's .databrickscfg.)
  • Added explanatory comments at each site.

Verification

  • Added unit tests for: the platform-specific binary name, toEnv() exposing DATABRICKS_CLI_PATH, and fromJSON ignoring a stale persisted databricksPath. Suite passes in the VS Code test host (14 relevant tests green).
  • Built the win32-x64 VSIX and confirmed the bundled extension/out/extension.js contains both the env var and the .exe path, with bin/databricks.exe packaged.

This pull request and its description were written by Isaac.

*Why*:
* On Windows, `databricks bundle` deploys failed with "databricks CLI not found" because the SDK/Terraform provider could not locate the bundled CLI.
* The forwarded path was extensionless (`bin/databricks`), but the bundled Windows binary is `databricks.exe`; the Go SDK/Terraform do a literal file lookup and do not auto-append `.exe` the way Windows CreateProcess does.
* The legacy project.json persisted the bundled CLI path (`databricksPath`), which `fromJSON` preferred over the freshly resolved one. That snapshot is version-pinned and, on Windows, extensionless, so it overrode the corrected path during legacy-to-bundle migration.

*What:*
* Forward the resolved CLI path to subprocesses via the DATABRICKS_CLI_PATH env var so they don't fall back to a PATH search.
* Make CliWrapper.cliPath return the platform-specific binary name (`databricks.exe` on win32, `databricks` elsewhere).
* In AuthProvider.fromJSON, always use the freshly resolved bundled CLI path and ignore the persisted `databricksPath`, since it is an extension-managed, version-pinned value that is stale after any upgrade.

*Verification:*
* Added unit tests for the platform-specific binary name, for toEnv() exposing DATABRICKS_CLI_PATH, and for fromJSON ignoring a stale persisted databricksPath; suite passes in the VS Code test host (14 relevant tests green).
* Built the win32-x64 VSIX and confirmed the bundled extension contains both the env var and the `.exe` path, with `bin/databricks.exe` packaged.

Co-authored-by: Isaac
@rugpanov rugpanov force-pushed the fix/databricks-cli-path-windows branch from 58d02a4 to 36a4dc1 Compare June 16, 2026 10:49
@rugpanov rugpanov temporarily deployed to test-trigger-is June 16, 2026 10:49 — with GitHub Actions Inactive
@rugpanov rugpanov temporarily deployed to test-trigger-is June 16, 2026 12:53 — with GitHub Actions Inactive
@github-actions

Copy link
Copy Markdown
Contributor

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/vscode

Inputs:

  • PR number: 1910
  • Commit SHA: 0cbab4593d1d1c7bcbeb8d6e92caa43831379d36

Checks will be approved automatically on success.

@rugpanov rugpanov merged commit 6fcb630 into main Jun 16, 2026
6 of 8 checks passed
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