Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitda02375

Browse files
fix: handleworkspace.agent andagent.workspace.owner incoder ssh (#18093)
Closes#18088.The linked issue is misleading -- `coder config-ssh` continues to support the `coder.` prefix. The reason the command`ssh coder.workspace.agent` fails is because `coder ssh workspace.agent` wasn't supported. This PR fixes that.We know we used to support `workspace.agent`, as this is what we recommend in the Web UI:![image](https://github.com/user-attachments/assets/702bbbc7-c586-4947-98a6-4508a481280b)This PR also adds support for `coder ssh agent.workspace.owner`, such that after running `coder config-ssh`, a command like```ssh agent.workspace.owner.coder```works, even without Coder Connect running. This is done for parity with an existing workflow that uses `ssh workspace.coder`, which either uses Coder Connect if available, or the CLI.
1 parent5cfcb73 commitda02375

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

‎cli/ssh.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,12 +1594,14 @@ func writeCoderConnectNetInfo(ctx context.Context, networkInfoDir string) error
15941594
// Converts workspace name input to owner/workspace.agent format
15951595
// Possible valid input formats:
15961596
// workspace
1597+
// workspace.agent
15971598
// owner/workspace
15981599
// owner--workspace
15991600
// owner/workspace--agent
16001601
// owner/workspace.agent
16011602
// owner--workspace--agent
16021603
// owner--workspace.agent
1604+
// agent.workspace.owner - for parity with Coder Connect
16031605
funcnormalizeWorkspaceInput(inputstring)string {
16041606
// Split on "/", "--", and "."
16051607
parts:=workspaceNameRe.Split(input,-1)
@@ -1608,8 +1610,15 @@ func normalizeWorkspaceInput(input string) string {
16081610
case1:
16091611
returninput// "workspace"
16101612
case2:
1613+
ifstrings.Contains(input,".") {
1614+
returnfmt.Sprintf("%s.%s",parts[0],parts[1])// "workspace.agent"
1615+
}
16111616
returnfmt.Sprintf("%s/%s",parts[0],parts[1])// "owner/workspace"
16121617
case3:
1618+
// If the only separator is a dot, it's the Coder Connect format
1619+
if!strings.Contains(input,"/")&&!strings.Contains(input,"--") {
1620+
returnfmt.Sprintf("%s/%s.%s",parts[2],parts[1],parts[0])// "owner/workspace.agent"
1621+
}
16131622
returnfmt.Sprintf("%s/%s.%s",parts[0],parts[1],parts[2])// "owner/workspace.agent"
16141623
default:
16151624
returninput// Fallback

‎cli/ssh_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,14 @@ func TestSSH(t *testing.T) {
107107

108108
cases:= []string{
109109
"myworkspace",
110+
"myworkspace.dev",
110111
"myuser/myworkspace",
111112
"myuser--myworkspace",
112113
"myuser/myworkspace--dev",
113114
"myuser/myworkspace.dev",
114115
"myuser--myworkspace--dev",
115116
"myuser--myworkspace.dev",
117+
"dev.myworkspace.myuser",
116118
}
117119

118120
for_,tc:=rangecases {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp