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
Add --auto-approve to experimental prompt sites (#5026)
## Why
The rest of the CLI already exposes `--auto-approve` on confirmation
prompts: `bundle deploy`, `bundle destroy`, `pipelines deploy`,
`pipelines destroy`, `completion install`, `completion uninstall`, `auth
logout`, and `apps delete` all have it. Five prompts in experimental
commands do not, which is inconsistent and also blocks any
non-interactive use of those commands (CI, scripts).
The five sites:
- `databricks ssh setup`: "Host already exists" prompt
- `databricks ssh connect`: required IDE extension install
- `databricks ssh connect`: IDE settings update
- `databricks apps dev-remote`: viewer connection request
- `databricks apps init`: optional resource confirmation
All five are in `Hidden: true` / experimental commands.
## Changes
Before: these prompts could not be bypassed, so these commands didn't
match the `--auto-approve` convention the rest of the CLI has settled
on.
Now: each of the four owning commands accepts `--auto-approve`, and the
prompt is skipped when the flag is set.
Follows the same convention as the commands listed above: a bool flag on
the command, threaded through the options struct, checked before the
prompt. No new cmdio helper, no context-based capability, no new pattern
- just applying the existing one to the last few places that didn't have
it.
Behavior details:
- **`ssh setup --auto-approve`**: recreates an existing host config
without prompting.
- **`ssh connect --auto-approve`**: installs the required IDE SSH
extension and applies missing IDE settings without prompting. Also
removes the `cmdio.IsPromptSupported` short-circuit on the settings path
so the flag works in non-TTY contexts (the whole point).
- **`apps dev-remote --auto-approve`**: auto-approves every viewer
connection for the life of the session. Help text flags the trust
implication (anyone with the shareable dev URL is trusted). Intended for
trusted environments only.
- **`apps init --auto-approve`**: skips the `Configure <optional
resource>?` confirmation. Optional resources are only configured when
their values are supplied via `--set plugin.resourceKey.field=value`.
No `NEXT_CHANGELOG.md` entry since all commands are experimental.
## Test plan
- [x] `make checks` clean
- [x] `make lint` clean
- [x] `go test ./experimental/ssh/... ./libs/apps/vite/...
./cmd/apps/...` passes
- [x] Unit tests added:
- `TestSetup_AutoApproveRecreatesExistingHost`: Setup with
AutoApprove=true recreates a pre-existing host config
- `TestCheckIDESSHExtension_AutoApproveMissing_Installs`: extension is
installed without a prompt
- `TestCheckIDESSHExtension_NoPrompt_WithoutAutoApprove_Errors`:
non-interactive without the flag still errors with install instructions
- `TestCheckAndUpdateSettings_AutoApproveWithoutPromptSupport`: settings
applied even when prompts are unsupported
- `TestCheckAndUpdateSettings_AutoApproveCreatesMissingFile`: missing
settings file is created
- `TestNewBridge_AutoApprove`: bridge stores the flag
- `TestBridgeHandleConnectionRequest_AutoApproveSkipsStdin`: connection
request is approved without reading stdin
- [ ] Manual: `databricks ssh setup --name h --cluster <id>` twice;
second run with `--auto-approve` recreates silently
- [ ] Manual: `databricks ssh connect --ide vscode --auto-approve` with
the SSH extension missing: installs without a prompt
- [ ] Manual: `databricks apps dev-remote --name <app> --auto-approve`:
external viewer opens the shareable URL and is approved without stdin
interaction
- [ ] Manual: `databricks apps init --name x --features analytics
--auto-approve`: optional resources are skipped when no `--set`
supplied; honored when `--set` is supplied
// Validate app exists and get domain before starting Vite
180
181
varappDomain*url.URL
@@ -234,6 +235,7 @@ Examples:
234
235
cmd.Flags().StringVar(&appName, "name", "", "Name of the app to connect to (prompts if not provided)")
235
236
cmd.Flags().StringVar(&clientPath, "client-path", "./client", "Path to the Vite client directory")
236
237
cmd.Flags().IntVar(&port, "port", vitePort, "Port to run the Vite server on")
238
+
cmd.Flags().BoolVar(&autoApprove, "auto-approve", false, "Automatically approve every viewer connection. Anyone with the shareable dev URL will be trusted for the life of the session; use only in trusted environments.")
cmd.Flags().BoolVar(&deploy, "deploy", false, "Deploy the app after creation")
180
182
cmd.Flags().StringVar(&run, "run", "", "Run the app after creation (none, dev, dev-remote)")
183
+
cmd.Flags().BoolVar(&autoApprove, "auto-approve", false, "Skip confirmation prompts for optional resources. Optional resources are only configured when their values are provided via --set.")
181
184
182
185
returncmd
183
186
}
@@ -198,6 +201,7 @@ type createOptions struct {
198
201
runChangedbool// true if --run flag was explicitly set
199
202
pluginsChangedbool// true if --plugins flag was explicitly set
Copy file name to clipboardExpand all lines: experimental/ssh/cmd/connect.go
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,7 @@ the SSH server and handling the connection proxy.
36
36
varliteswapstring
37
37
varskipSettingsCheckbool
38
38
varenvironmentVersionint
39
+
varautoApprovebool
39
40
40
41
cmd.Flags().StringVar(&clusterID, "cluster", "", "Databricks cluster ID (for dedicated clusters)")
41
42
cmd.Flags().DurationVar(&shutdownDelay, "shutdown-delay", defaultShutdownDelay, "Delay before shutting down the server after the last client disconnects")
@@ -71,6 +72,8 @@ the SSH server and handling the connection proxy.
71
72
cmd.Flags().IntVar(&environmentVersion, "environment-version", defaultEnvironmentVersion, "Environment version for serverless compute")
72
73
cmd.Flags().MarkHidden("environment-version")
73
74
75
+
cmd.Flags().BoolVar(&autoApprove, "auto-approve", false, "Skip confirmation prompts, installing IDE extensions and applying IDE settings without asking")
cmd.Flags().BoolVar(&autoStartCluster, "auto-start-cluster", true, "Automatically start the cluster when establishing the ssh connection")
36
37
cmd.Flags().StringVar(&sshConfigPath, "ssh-config", "", "Path to SSH config file (default ~/.ssh/config)")
37
38
cmd.Flags().DurationVar(&shutdownDelay, "shutdown-delay", defaultShutdownDelay, "SSH server will terminate after this delay if there are no active connections")
0 commit comments