ssh setup: use the shared cluster picker so duplicate cluster names work - #6298
ssh setup: use the shared cluster picker so duplicate cluster names work#6298TangoEnSkai wants to merge 1 commit into
Conversation
The interactive picker called ClusterDetailsClusterNameToClusterIdMap, which builds a map keyed by cluster display name. Databricks allows several clusters to share a name, so listing failed outright with "duplicate .ClusterName". Use cfgpickers.AskForCluster instead. It lists with the same API/UI cluster-source filter, keys the picker by list position rather than by name, and already renders the cluster ID next to the name so duplicates can be told apart. Two side effects worth noting: the picker now auto-selects when the workspace has exactly one cluster, and it shows state, access mode and runtime, which costs a CurrentUser.Me and a SparkVersions call. Part of databricks#974. The generated commands in cmd/workspace/clusters still use the name-keyed helper; those come from the SDK generator and are not fixable here.
|
An authorized user can trigger integration tests manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
Waiting for approvalBased on git history, these people are best suited to review:
Eligible reviewers: Suggestions based on git history. See OWNERS for ownership rules. |
|
@pietern you have the most recent work in The fix itself is small — it reuses
If either is unwanted, the alternative is to build the picker list locally in Worth noting this does not close #974 — |
Changes
The
ssh setupinteractive cluster picker calledClusterDetailsClusterNameToClusterIdMap, which builds amap[string]stringkeyed by cluster display name. Databricks allows several clusters to share a
name, so on those workspaces listing failed outright:
This switches the prompt to
cfgpickers.AskForCluster, the pickerauth login --configure-clusteralready uses. It fits without modification:ListAllwith the sameClusterSourceApi/ClusterSourceUifilter this prompt was already using,
names are not a problem,
distinguishable in the list.
Passing no filters keeps the current selection semantics — every API/UI
cluster stays eligible.
Two behaviour changes worth calling out explicitly:
AskForClusterreturns itwithout prompting. Previously
ssh setupalways prompted.Rendering those costs one
CurrentUser.Meand oneSparkVersionscall.The prompt label changes from "The cluster to connect to" to
AskForCluster's "Choose compatible cluster".Why
Users on workspaces with duplicate cluster names cannot use
ssh setupinteractively at all — the command fails before showing anything, and the
only way forward is to find the cluster ID by hand and pass
--cluster.Reusing the existing picker rather than adding a second one keeps the two
interactive cluster selections in the CLI behaving the same way.
Part of #974. That issue was originally reported against
auth login --configure-cluster, which was fixed by moving toAskForCluster;ssh setupwas left on the name-keyed SDK helper. Note itdoes not close the issue completely: the generated commands in
cmd/workspace/clustersstill call the same helper in 13 places, but thoseare produced by the SDK generator and cannot be fixed in this repository.
Tests
go test ./experimental/ssh/... ./libs/databrickscfg/...— all green.Two tests added to
experimental/ssh/internal/setup/setup_test.go, drivingdefaultClusterSelectionPromptagainstqa.HTTPFixtures:succeed and reach the picker, which cannot run without a TTY, so the test
asserts the failure comes from the picker and not from loading. Against
mainthis fails withduplicate .ClusterName: shared name.