You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Generalize CLI token source into progressive command list
Replace the three explicit command fields (forceCmd, profileCmd, hostCmd)
with a []cliCommand list and an activeCommandIndex. Feature flags are
defined statically in cliFeatureFlags and stripped progressively to
build commands for older CLI versions.
Token() now iterates from activeCommandIndex, falling back on unknown
flag errors and caching the working command index for subsequent calls.
Adding future flags (e.g. --scopes) requires only a one-line addition
to the cliFeatureFlags slice.
Signed-off-by: Mihai Mitrea <mihai.mitrea@databricks.com>
Copy file name to clipboardExpand all lines: NEXT_CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,7 @@
22
22
23
23
### Internal Changes
24
24
25
+
* Generalize CLI token source into a progressive command list for forward-compatible flag support.
25
26
* Normalize internal token sources on `auth.TokenSource` for proper context propagation ([#1577](https://github.com/databricks/databricks-sdk-go/pull/1577)).
26
27
* Fix `TestAzureGithubOIDCCredentials` hang caused by missing `HTTPTransport` stub: `EnsureResolved` now calls `resolveHostMetadata`, which makes a real network request when no transport is set ([#1550](https://github.com/databricks/databricks-sdk-go/pull/1550)).
27
28
* Bump golang.org/x/crypto from 0.21.0 to 0.45.0 in /examples/slog ([#1566](https://github.com/databricks/databricks-sdk-go/pull/1566)).
warningMessage: "Databricks CLI does not support --force-refresh flag. The CLI's token cache may provide stale tokens. Please upgrade your CLI to the latest version.",
logger.Warnf(ctx, "Databricks CLI does not support --force-refresh flag. The CLI's token cache may provide stale tokens. Please upgrade your CLI to the latest version.")
114
+
ifidx:=int(c.activeCommandIndex.Load()); idx>=0 {
115
+
returnc.execCliCommand(ctx, c.commands[idx].args)
100
116
}
117
+
returnc.probeAndExec(ctx)
118
+
}
101
119
102
-
ifc.profileCmd!=nil {
103
-
tok, err:=c.execCliCommand(ctx, c.profileCmd)
120
+
// probeAndExec walks the command list from most-featured to simplest, looking
121
+
// for a CLI command that succeeds. When a command fails with "unknown flag" for
122
+
// one of its [cliCommand.usedFlags], it logs a warning and tries the next.
123
+
// On success, [activeCommandIndex] is stored so future calls skip probing.
0 commit comments