From 98e786024b6e0244ca99d040e484f6dd5a49a0cb Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Fri, 30 May 2025 10:58:58 +0000 Subject: [PATCH] Update SSH usage examples and documentation Revise various parts of the CLI and documentation to reflect the new SSH connection format for workspaces. Update usage examples from the outdated "ssh coder.workspace" format to the new "ssh workspace.coder" format. Additionally, ensure correct formation in commands by adding workspace owner username and hostname suffix through recent data sources. --- cli/configssh.go | 2 +- cli/testdata/coder_--help.golden | 2 +- cli/testdata/coder_config-ssh_--help.golden | 2 +- docs/manifest.json | 2 +- docs/reference/cli/config-ssh.md | 2 +- docs/reference/cli/index.md | 2 +- docs/tutorials/testing-templates.md | 3 +-- site/src/modules/resources/AgentRow.tsx | 1 + site/src/modules/resources/SSHButton/SSHButton.tsx | 6 ++++-- 9 files changed, 12 insertions(+), 10 deletions(-) diff --git a/cli/configssh.go b/cli/configssh.go index e3e168d2b198c..cfea6b377f6ee 100644 --- a/cli/configssh.go +++ b/cli/configssh.go @@ -235,7 +235,7 @@ func (r *RootCmd) configSSH() *serpent.Command { cmd := &serpent.Command{ Annotations: workspaceCommand, Use: "config-ssh", - Short: "Add an SSH Host entry for your workspaces \"ssh coder.workspace\"", + Short: "Add an SSH Host entry for your workspaces \"ssh workspace.coder\"", Long: FormatExamples( Example{ Description: "You can use -o (or --ssh-option) so set SSH options to be used for all your workspaces", diff --git a/cli/testdata/coder_--help.golden b/cli/testdata/coder_--help.golden index f3c6f56a7a191..1b2dbcf25056b 100644 --- a/cli/testdata/coder_--help.golden +++ b/cli/testdata/coder_--help.golden @@ -18,7 +18,7 @@ SUBCOMMANDS: completion Install or update shell completion scripts for the detected or chosen shell. config-ssh Add an SSH Host entry for your workspaces "ssh - coder.workspace" + workspace.coder" create Create a workspace delete Delete a workspace dotfiles Personalize your workspace by applying a canonical diff --git a/cli/testdata/coder_config-ssh_--help.golden b/cli/testdata/coder_config-ssh_--help.golden index 86f38db99e84a..e2b03164d9513 100644 --- a/cli/testdata/coder_config-ssh_--help.golden +++ b/cli/testdata/coder_config-ssh_--help.golden @@ -3,7 +3,7 @@ coder v0.0.0-devel USAGE: coder config-ssh [flags] - Add an SSH Host entry for your workspaces "ssh coder.workspace" + Add an SSH Host entry for your workspaces "ssh workspace.coder" - You can use -o (or --ssh-option) so set SSH options to be used for all your diff --git a/docs/manifest.json b/docs/manifest.json index b113a48b6cb15..4064725498128 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -1091,7 +1091,7 @@ }, { "title": "config-ssh", - "description": "Add an SSH Host entry for your workspaces \"ssh coder.workspace\"", + "description": "Add an SSH Host entry for your workspaces \"ssh workspace.coder\"", "path": "reference/cli/config-ssh.md" }, { diff --git a/docs/reference/cli/config-ssh.md b/docs/reference/cli/config-ssh.md index c9250523b6c28..607aa86849dd2 100644 --- a/docs/reference/cli/config-ssh.md +++ b/docs/reference/cli/config-ssh.md @@ -1,7 +1,7 @@ # config-ssh -Add an SSH Host entry for your workspaces "ssh coder.workspace" +Add an SSH Host entry for your workspaces "ssh workspace.coder" ## Usage diff --git a/docs/reference/cli/index.md b/docs/reference/cli/index.md index 2106374eba150..d72790fc3bfdb 100644 --- a/docs/reference/cli/index.md +++ b/docs/reference/cli/index.md @@ -41,7 +41,7 @@ Coder — A tool for provisioning self-hosted development environments with Terr | [users](./users.md) | Manage users | | [version](./version.md) | Show coder version | | [autoupdate](./autoupdate.md) | Toggle auto-update policy for a workspace | -| [config-ssh](./config-ssh.md) | Add an SSH Host entry for your workspaces "ssh coder.workspace" | +| [config-ssh](./config-ssh.md) | Add an SSH Host entry for your workspaces "ssh workspace.coder" | | [create](./create.md) | Create a workspace | | [delete](./delete.md) | Delete a workspace | | [favorite](./favorite.md) | Add a workspace to your favorites | diff --git a/docs/tutorials/testing-templates.md b/docs/tutorials/testing-templates.md index 45250a6a71aac..1ab617161d319 100644 --- a/docs/tutorials/testing-templates.md +++ b/docs/tutorials/testing-templates.md @@ -103,9 +103,8 @@ jobs: - name: Create a test workspace and run some example commands run: | coder create -t $TEMPLATE_NAME --template-version ${{ steps.name.outputs.version_name }} test-${{ steps.name.outputs.version_name }} --yes - coder config-ssh --yes # run some example commands - ssh coder.test-${{ steps.name.outputs.version_name }} -- make build + coder ssh test-${{ steps.name.outputs.version_name }} -- make build - name: Delete the test workspace if: always() diff --git a/site/src/modules/resources/AgentRow.tsx b/site/src/modules/resources/AgentRow.tsx index 407c8c1bd84c6..7687339ae0e97 100644 --- a/site/src/modules/resources/AgentRow.tsx +++ b/site/src/modules/resources/AgentRow.tsx @@ -196,6 +196,7 @@ export const AgentRow: FC = ({ )} {proxy.preferredWildcardHostname !== "" && diff --git a/site/src/modules/resources/SSHButton/SSHButton.tsx b/site/src/modules/resources/SSHButton/SSHButton.tsx index 5b21ff079fe13..bf1ef33520de3 100644 --- a/site/src/modules/resources/SSHButton/SSHButton.tsx +++ b/site/src/modules/resources/SSHButton/SSHButton.tsx @@ -22,15 +22,17 @@ import { docs } from "utils/docs"; interface AgentSSHButtonProps { workspaceName: string; agentName: string; + workspaceOwnerUsername: string; } export const AgentSSHButton: FC = ({ workspaceName, agentName, + workspaceOwnerUsername, }) => { const paper = useClassName(classNames.paper, []); const { data } = useQuery(deploymentSSHConfig()); - const sshPrefix = data?.hostname_prefix; + const sshSuffix = data?.hostname_suffix; return ( @@ -58,7 +60,7 @@ export const AgentSSHButton: FC = ({ />