Commit 6fcb630
authored
Pass DATABRICKS_CLI_PATH and resolve the platform-specific CLI binary (#1910)
## 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.1 parent 260248e commit 6fcb630
4 files changed
Lines changed: 123 additions & 3 deletions
File tree
- packages/databricks-vscode/src
- cli
- configuration/auth
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
25 | 30 | | |
26 | 31 | | |
27 | 32 | | |
| |||
53 | 58 | | |
54 | 59 | | |
55 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
56 | 88 | | |
57 | 89 | | |
58 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
298 | 298 | | |
299 | 299 | | |
300 | 300 | | |
301 | | - | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
302 | 310 | | |
303 | 311 | | |
304 | 312 | | |
| |||
Lines changed: 69 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
Lines changed: 12 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | | - | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
167 | 174 | | |
168 | 175 | | |
169 | 176 | | |
| |||
355 | 362 | | |
356 | 363 | | |
357 | 364 | | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
358 | 369 | | |
359 | 370 | | |
360 | 371 | | |
| |||
0 commit comments