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(agent): wire up agentssh server to allow exec into container#16638

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
johnstcn merged 14 commits intomainfromcj/agent-pty-container
Feb 26, 2025

Conversation

johnstcn
Copy link
Member

@johnstcnjohnstcn commentedFeb 19, 2025
edited
Loading

Relates to#16419

Builds on top of#16623 and wires up the ReconnectingPTY server. This does nothing to wire up the web terminal yet but the added test demonstrates the functionality working.

Other changes:

@johnstcnjohnstcn self-assigned thisFeb 19, 2025
@johnstcnjohnstcn changed the titleCj/agent pty containerfeat(agent): write up reconnectingpty server to container execFeb 19, 2025
@johnstcnjohnstcnforce-pushed thecj/agent-pty-container branch 2 times, most recently fromd096ac4 to56cb9e9CompareFebruary 19, 2025 23:20
@johnstcnjohnstcn changed the titlefeat(agent): write up reconnectingpty server to container execfeat(agent): wire up agentssh server to allow exec into containerFeb 19, 2025
@johnstcnjohnstcn marked this pull request as draftFebruary 20, 2025 09:59
Base automatically changed fromcj/agent-docker-envinfo tomainFebruary 24, 2025 15:05
Comment on lines -701 to -739
// EnvInfoer encapsulates external information required by CreateCommand.
typeEnvInfoerinterface {
// CurrentUser returns the current user.
CurrentUser() (*user.User,error)
// Environ returns the environment variables of the current process.
Environ() []string
// UserHomeDir returns the home directory of the current user.
UserHomeDir() (string,error)
// UserShell returns the shell of the given user.
UserShell(usernamestring) (string,error)
}

typesystemEnvInfoerstruct{}

vardefaultEnvInfoerEnvInfoer=&systemEnvInfoer{}

// DefaultEnvInfoer returns a default implementation of
// EnvInfoer. This reads information using the default Go
// implementations.
funcDefaultEnvInfoer()EnvInfoer {
returndefaultEnvInfoer
}

func (systemEnvInfoer)CurrentUser() (*user.User,error) {
returnuser.Current()
}

func (systemEnvInfoer)Environ() []string {
returnos.Environ()
}

func (systemEnvInfoer)UserHomeDir() (string,error) {
returnuserHomeDir()
}

func (systemEnvInfoer)UserShell(usernamestring) (string,error) {
returnusershell.Get(username)
}

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

review: moved tousershell package

Comment on lines -131 to -143
func (*DockerEnvInfoer)Environ() []string {
// Return a clone of the environment so that the caller can't modify it
returnos.Environ()
}

func (*DockerEnvInfoer)UserHomeDir() (string,error) {
// We default the working directory of the command to the user's home
// directory. Since this came from inside the container, we cannot guarantee
// that this exists on the host. Return the "real" home directory of the user
// instead.
returnos.UserHomeDir()
}

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

review: we now use the embeddedusershell.SystemEnvInfo instead

@johnstcnjohnstcn marked this pull request as ready for reviewFebruary 25, 2025 12:29
Copy link
Contributor

@dannykoppingdannykopping left a comment

Choose a reason for hiding this comment

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

LGTM

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.

Looks great 👍🏻, minor nits/suggestions inline.

slog.F("before",append([]string{name},args...)),
slog.F("after",append([]string{modifiedName},modifiedArgs...)),
)
cmd:=s.Execer.PTYCommandContext(ctx,modifiedName,modifiedArgs...)
Copy link
Member

Choose a reason for hiding this comment

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

Didn't we also have a docker execer? Did we end up not implementing that change, and are only relying on env infoer now? Or are we modifying commands from multiple angles? If former, all good, if latter, I'm wondering if we could unify the concepts (perhaps infoer can be applied on the execer level or vice-versa).

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

That's all in the envinfoer now.

mafredri reacted with thumbs up emoji

// HomeDir returns the home directory of the current user, giving
// priority to the $HOME environment variable.
funcHomeDir() (string,error) {
Copy link
Member

Choose a reason for hiding this comment

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

Is this still useful as a separate function or should we just require usage of envinfoer?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I'd like to unexport it and require going through envinfoer, but trying to keep the scope of refactorings small here.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I'm going to mark it as deprecated for now, we can remove it later.

mafredri reacted with thumbs up emoji
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.

Just one minor suggestion, but otherwise this is great 👍🏻

@johnstcnjohnstcn merged commit172e523 intomainFeb 26, 2025
30 checks passed
@johnstcnjohnstcn deleted the cj/agent-pty-container branchFebruary 26, 2025 09:03
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsFeb 26, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@mafredrimafredrimafredri approved these changes

@dannykoppingdannykoppingdannykopping approved these changes

Assignees

@johnstcnjohnstcn

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@johnstcn@mafredri@dannykopping

[8]ページ先頭

©2009-2025 Movatter.jp