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

config-ssh: always support agent name in host alias#3036

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
dwahler merged 1 commit intomainfromdwahler/2969-config-ssh-agent-names
Jul 21, 2022

Conversation

dwahler
Copy link
Contributor

This PR adjusts the behavior ofcoder config-ssh so that italways creates aliases of the formcoder.<WORKSPACE_NAME>.<AGENT_NAME>, and additionally creates an alias of the formcoder.<WORKSPACE_NAME> if the workspace has exactly one agent. This is more consistent with the behavior ofcoder ssh, and prevents us from incorrectly rejecting commands that are suggested by UI tooltips.

I believe the original logic was subtly incorrect, because it only considered how many agents existed in each workspace resource, not the total number of agents in the workspace. So if a workspace had two resources with one agent each, it would have generated multiple invalidcoder.<WORKSPACE_NAME> aliases, instead of the correct aliases with the agent name.

Fixes#2969

@dwahlerdwahler requested review fromBrunoQuaresma anda teamJuly 18, 2022 23:30

// handle both WORKSPACE and WORKSPACE.AGENT syntax
if len(agents) == 1 {
wc.Hosts = append(wc.Hosts, workspace.Name)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

We should probably invent "default agent" as a flag in the coder_agent resource or something otherwise this may become annoying, could be a good follow up

mafredri reacted with thumbs up emoji
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This sounds like a great idea! I'm guessing we'd have to update the TF provider, update all TF templates (to set default) and ensure that only one resource has the default agent set?

(Might be a bad idea, but we could consider the first one the default, as a fallback.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Default could also be optional to avoid backwards incompatibility. If there's no default agent then we never setcoder.workspace_name, and only setcoder.workspace_name.agent_name

Copy link
Member

@mafredrimafredri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Nice solution and tests!


// handle both WORKSPACE and WORKSPACE.AGENT syntax
if len(agents) == 1 {
wc.Hosts = append(wc.Hosts, workspace.Name)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This sounds like a great idea! I'm guessing we'd have to update the TF provider, update all TF templates (to set default) and ensure that only one resource has the default agent set?

(Might be a bad idea, but we could consider the first one the default, as a fallback.)

result = append(result, tokenScanner.Text())
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Minor (non-blocking): We could consider checkinglineScanner.Err() after the loop (similarly withtokenScanner). I realize it's quite inconsequential for how this function is used, it's more of a best practice.

@kylecarbs
Copy link
Member

@dwahler is this good to merge? We should probably get this out in a patch release.

dwahler reacted with thumbs up emoji

@dwahlerdwahler merged commit7f54628 intomainJul 21, 2022
@dwahlerdwahler deleted the dwahler/2969-config-ssh-agent-names branchJuly 21, 2022 19:49
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@deansheatherdeansheatherdeansheather approved these changes

@mafredrimafredrimafredri approved these changes

@BrunoQuaresmaBrunoQuaresmaAwaiting requested review from BrunoQuaresma

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Workspace SSH access button tooltip provides invalid command
4 participants
@dwahler@kylecarbs@mafredri@deansheather

[8]ページ先頭

©2009-2025 Movatter.jp