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

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

Merged
kylecarbs merged 19 commits intomainfromworkspaceagent
Feb 19, 2022
Merged

feat: Add workspace agent for SSH#318

kylecarbs merged 19 commits intomainfromworkspaceagent
Feb 19, 2022

Conversation

kylecarbs
Copy link
Member

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.

bryphe-coder reacted with hooray emoji
@codecov
Copy link

codecovbot commentedFeb 18, 2022
edited
Loading

Codecov Report

Merging#318 (516b605) intomain (65de96c) willincrease coverage by0.16%.
The diff coverage is63.73%.

Impacted file tree graph

@@            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
FlagCoverage Δ
unittest-go-macos-latest66.49% <65.06%> (+0.47%)⬆️
unittest-go-ubuntu-latest67.57% <64.77%> (+0.14%)⬆️
unittest-go-windows-202265.95% <64.12%> (+0.16%)⬆️
unittest-js63.61% <ø> (ø)
Impacted FilesCoverage Δ
pty/pty_other.go35.89% <0.00%> (ø)
pty/start_windows.go51.30% <20.00%> (-0.95%)⬇️
agent/usershell/usershell_other.go60.00% <60.00%> (ø)
agent/agent.go66.08% <66.08%> (ø)
pty/ptytest/ptytest.go90.74% <66.66%> (+0.94%)⬆️
pty/start_other.go72.00% <66.66%> (+1.16%)⬆️
pty/pty_windows.go60.31% <80.00%> (+1.30%)⬆️
coderd/coderdtest/coderdtest.go100.00% <100.00%> (ø)
pty/start.go100.00% <100.00%> (ø)
... and4 more

Continue to review full report at Codecov.

Legend -Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered byCodecov. Last update65de96c...516b605. Read thecomment docs.

@@ -0,0 +1,293 @@
package agent
Copy link
Contributor

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?

Copy link
MemberAuthor

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.

bryphe-coder reacted with thumbs up emoji
Copy link
Contributor

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 ascoder agent start, or something of the like.

That sounds good!

I initially had this incli/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 👍

kylecarbs reacted with heart emoji
returnnil,err
}
sshConn,channels,requests,err:=gossh.NewClientConn(netConn,"localhost:22",&gossh.ClientConfig{
User:"kyle",
Copy link
Contributor

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?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Oops, yes haha!

@kylecarbskylecarbsforce-pushed theworkspaceagent branch 2 times, most recently from7ec58fb to2c477aaCompareFebruary 18, 2022 03:57
Copy link
Contributor

@bryphe-coderbryphe-coder left a 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 😄

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.
returnnil,nil,xerrors.Errorf("find process %d: %w",processInfo.ProcessId,err)
}
gofunc() {
_,_=process.Wait()
Copy link
Contributor

@bryphe-coderbryphe-coderFeb 18, 2022
edited
Loading

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.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Yup, will add!

bryphe-coder reacted with heart emoji
Copy link
MemberAuthor

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

@kylecarbskylecarbsforce-pushed theworkspaceagent branch 2 times, most recently from11e5274 to0c755fbCompareFebruary 18, 2022 05:33
@kylecarbskylecarbs merged commit91bf863 intomainFeb 19, 2022
@kylecarbskylecarbs deleted the workspaceagent branchFebruary 19, 2022 05:13
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

1 more reviewer

@bryphe-coderbryphe-coderbryphe-coder approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

@kylecarbskylecarbs

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@kylecarbs@bryphe-coder

[8]ページ先頭

©2009-2025 Movatter.jp