Skip to content

feat(cli): implement ssh remote forward #8515

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
make gen
  • Loading branch information
mtojek committed Jul 14, 2023
commit cb0f9642462ba044a720c8df51a5530a36aaddae
8 changes: 8 additions & 0 deletions cli/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func (r *RootCmd) ssh() *clibase.Cmd {
waitEnum string
noWait bool
logDirPath string
remoteForward string
)
client := new(codersdk.Client)
cmd := &clibase.Cmd{
Expand Down Expand Up @@ -424,6 +425,13 @@ func (r *RootCmd) ssh() *clibase.Cmd {
FlagShorthand: "l",
Value: clibase.StringOf(&logDirPath),
},
{
Flag: "remote-forward",
Description: "Enable remote port forwarding.",
Env: "CODER_SSH_REMOTE_FORWARD",
FlagShorthand: "R",
Value: clibase.StringOf(&remoteForward),
},
}
return cmd
}
Expand Down
3 changes: 3 additions & 0 deletions cli/testdata/coder_ssh_--help.golden
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ Start a shell into a workspace
behavior as non-blocking.
DEPRECATED: Use --wait instead.

-R, --remote-forward string, $CODER_SSH_REMOTE_FORWARD
Enable remote port forwarding.

--stdio bool, $CODER_SSH_STDIO
Specifies whether to emit SSH output over stdin/stdout.

Expand Down
9 changes: 9 additions & 0 deletions docs/cli/ssh.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ Specify the directory containing SSH diagnostic log files.

Enter workspace immediately after the agent has connected. This is the default if the template has configured the agent startup script behavior as non-blocking.

### -R, --remote-forward

| | |
| ----------- | -------------------------------------- |
| Type | <code>string</code> |
| Environment | <code>$CODER_SSH_REMOTE_FORWARD</code> |

Enable remote port forwarding.

### --stdio

| | |
Expand Down