feat: add --ssh-host-prefix flag for "coder ssh" (#16088)

This adds a flag matching `--ssh-host-prefix` from `coder config-ssh` to
`coder ssh`. By trimming a custom prefix from the argument, we can set
up wildcard-based `Host` entries in SSH config for the IDE plugins (and
eventually `coder config-ssh`).

We also replace `--` in the argument with `/`, so ownership can be
specified in wildcard-based SSH hosts like `<owner>--<workspace>`.

Replaces #16087.

Part of https://github.com/coder/coder/issues/14986.

Related to https://github.com/coder/coder/pull/16078 and
https://github.com/coder/coder/pull/16080.
This commit is contained in:
Aaron Lehmann
2025-01-13 19:07:21 -06:00
committed by GitHub
parent ec6645b832
commit 1aa9e32a2b
4 changed files with 89 additions and 1 deletions
+5
View File
@@ -45,6 +45,11 @@ OPTIONS:
-R, --remote-forward string-array, $CODER_SSH_REMOTE_FORWARD
Enable remote port forwarding (remote_port:local_address:local_port).
--ssh-host-prefix string, $CODER_SSH_SSH_HOST_PREFIX
Strip this prefix from the provided hostname to determine the
workspace name. This is useful when used as part of an OpenSSH proxy
command.
--stdio bool, $CODER_SSH_STDIO
Specifies whether to emit SSH output over stdin/stdout.