Commit c968abd
committed
Detect Databricks CLI version to gate
`--profile` on `databricks auth token` is a global Cobra flag, so old
CLIs (< v0.207.1) silently accept it and fail later with `cannot fetch
credentials` instead of `unknown flag: --profile`. The previous
error-based fallback never matched, leaving the `--host` fallback as
dead code.
This commit replaces the runtime fallback chain with version-based
capability detection:
* `CliVersion` carries a (major, minor, patch) triple plus an
`UNKNOWN` sentinel and a default-dev-build (0,0,0) check.
* `DatabricksCliCredentialsProvider` runs `databricks version --output
json` once per CLI path (cached on success only, with a 5s timeout)
and gates `--profile` on >= v0.207.1; everything else falls back to
`--host` with a precise warning.
* `CliTokenSource` is simplified to a single `cmd`; the
`fallbackCmd` parameter and the runtime "unknown flag" retry loop are
removed.
Mirrors the equivalent refactors in the Go and Python SDKs:
* databricks/databricks-sdk-go#1605
* databricks/databricks-sdk-py#1377
Co-authored-by: Isaac--profile support1 parent f850f56 commit c968abd
7 files changed
Lines changed: 893 additions & 225 deletions
File tree
- databricks-sdk-java/src
- main/java/com/databricks/sdk/core
- test/java/com/databricks/sdk/core
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
Lines changed: 0 additions & 34 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | 33 | | |
39 | 34 | | |
40 | 35 | | |
| |||
58 | 53 | | |
59 | 54 | | |
60 | 55 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | 56 | | |
73 | 57 | | |
74 | 58 | | |
75 | 59 | | |
76 | 60 | | |
77 | | - | |
78 | | - | |
79 | 61 | | |
80 | 62 | | |
81 | 63 | | |
| |||
158 | 140 | | |
159 | 141 | | |
160 | 142 | | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | 143 | | |
178 | 144 | | |
179 | 145 | | |
| |||
0 commit comments