- Notifications
You must be signed in to change notification settings - Fork1k
feat: Add workspace agent for SSH#318
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
codecovbot commentedFeb 18, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov Report
@@ Coverage Diff @@## main #318 +/- ##==========================================+ Coverage 67.53% 67.70% +0.16%========================================== Files 140 142 +2 Lines 7443 7700 +257 Branches 77 77 ==========================================+ Hits 5027 5213 +186- Misses 1905 1960 +55- Partials 511 527 +16
Continue to review full report at Codecov.
|
@@ -0,0 +1,293 @@ | |||
package agent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Will this agent be run as a standalone executable, or part ofcoderd
? If it is the former - maybe it would make sense to beagentd
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Part of thecoder
CLI! I was debating the name and structure internally. The purpose is the listening agent inside of a workspace for enabling access. It'll be added ascoder agent start
, or something of the like.
I initially had this incli/agent
, but felt that unnecessarily nested core business logic. Beyond that, it's likely this package will be used for tests that aren't relevant to the CLI at all. eg.agenttest.New
will likely exist.
I'd appreciate your thoughts here. It's more of an agent than a daemon, because it doesn't require system-level privileges, and is active rather than passive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks for all the helpful details@kylecarbs !
It'll be added as
coder agent start
, or something of the like.
That sounds good!
I initially had this in
cli/agent
, but felt that unnecessarily nested core business logic.
Agreed, it seems like our convention here is to have packages at the top-level - don't see a compelling reason to switch that.
It's more of an agent than a daemon, because it doesn't require system-level privileges, and is active rather than passive.
Makes sense to me 👍
agent/agent.go Outdated
returnnil,err | ||
} | ||
sshConn,channels,requests,err:=gossh.NewClientConn(netConn,"localhost:22",&gossh.ClientConfig{ | ||
User:"kyle", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Will this user be configurable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Oops, yes haha!
7ec58fb
to2c477aa
CompareThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Just some questions inline - but overall looks great. Exciting to have theagent
piece come together. Hopefully that means we canssh
into workspaces soon 😄
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
This adds the initial agent that supports TTYand execution over SSH. It functions across MacOS,Windows, and Linux.This does not handle the coderd interaction yet,but does setup a simple path forward.
Uh oh!
There was an error while loading.Please reload this page.
pty/start_windows.go Outdated
returnnil,nil,xerrors.Errorf("find process %d: %w",processInfo.ProcessId,err) | ||
} | ||
gofunc() { | ||
_,_=process.Wait() |
bryphe-coderFeb 18, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
It might be worth adding logging here too with the exit code of the process.
I saw this failure in a recent run:
ptytest.go:82: Error Trace:ptytest.go:82 start_windows_test.go:24 Error: Received unexpected error: read |0: file already closed Test: TestStart/Echo
https://github.com/coder/coder/runs/5242887100?check_suite_focus=true#step:7:239
And I suspect this part of the change might be related. Having the logging could help give details here. It could be a race in that the process might exit and thepty
is closed before being fully read by the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Yup, will add!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
CI caught a real issue here! Fixed in42656a4
11e5274
to0c755fb
CompareCloses#317. We depended on the context canceling the yamux connection,but this isn't a sync operation. Explicitly calling close ensures thehandler waits for yamux to complete before exit.
This adds the initial agent that supports TTY
and execution over SSH. It functions across MacOS,
Windows, and Linux.
This does not handle the coderd interaction yet,
but does setup a simple path forward.