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/agentcontainers): implement sub agent injection#18245

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
mafredri merged 18 commits intomainfrommafredri/feat-agent-devcontainer-injection-4
Jun 10, 2025
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
18 commits
Select commitHold shift + click to select a range
7358ee0
feat(agent/agentcontainers): implement sub agent injection
mafredriJun 4, 2025
34aa574
implement sub agent url
mafredriJun 6, 2025
7a3c8a3
improve doc on container workspace folder, add todo
mafredriJun 6, 2025
eb29bba
fix coderd and cli tests
mafredriJun 6, 2025
aa42ab8
fix
mafredriJun 6, 2025
fb4cdad
skip test on win
mafredriJun 9, 2025
cf17cd4
fix review comments
mafredriJun 9, 2025
780483b
ensure agent binary permissions owner/o+rx
mafredriJun 9, 2025
934a222
update cap net admin comment
mafredriJun 9, 2025
56c7ceb
implement fake agent api sub agent methods
mafredriJun 9, 2025
591a9bf
do not set workspace folder if container id
mafredriJun 9, 2025
9afa5ea
add WithContainerLabelIncludeFilter
mafredriJun 9, 2025
050177b
add sub agent env and revert container id change
mafredriJun 9, 2025
d5eb3fc
add sub agent as part of autostart integration test
mafredriJun 9, 2025
1629bee
fixup! add sub agent env and revert container id change
mafredriJun 9, 2025
67ee0c5
fixup! add sub agent as part of autostart integration test
mafredriJun 9, 2025
757dc85
fixup! fixup! add sub agent env and revert container id change
mafredriJun 9, 2025
dc7f7c3
use the correct directory for the sub agent
mafredriJun 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
ensure agent binary permissions owner/o+rx
  • Loading branch information
@mafredri
mafredri committedJun 9, 2025
commit780483b847896ee013248c31bd81ba49838a0924
6 changes: 5 additions & 1 deletionagent/agentcontainers/api.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1025,9 +1025,13 @@ func (api *API) injectSubAgentIntoContainerLocked(ctx context.Context, dc coders
logger.Info(ctx, "copied agent binary to container")

// Make sure the agent binary is executable so we can run it.
if _, err := api.ccli.ExecAs(ctx, container.ID, "root", "chmod", "+x", coderPathInsideContainer); err != nil {
if _, err := api.ccli.ExecAs(ctx, container.ID, "root", "chmod", "0755", path.Dir(coderPathInsideContainer), coderPathInsideContainer); err != nil {
return xerrors.Errorf("set agent binary executable: %w", err)
}
// Set the owner of the agent binary to root:root (UID 0, GID 0).
if _, err := api.ccli.ExecAs(ctx, container.ID, "root", "chown", "0:0", path.Dir(coderPathInsideContainer), coderPathInsideContainer); err != nil {
return xerrors.Errorf("set agent binary owner: %w", err)
}

// Attempt to add CAP_NET_ADMIN to the binary to improve network
// performance (optional, allow to fail).
Expand Down
6 changes: 4 additions & 2 deletionsagent/agentcontainers/api_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1278,7 +1278,8 @@ func TestAPI(t *testing.T) {
mCCLI.EXPECT().DetectArchitecture(gomock.Any(), "test-container-id").Return(runtime.GOARCH, nil),
mCCLI.EXPECT().ExecAs(gomock.Any(), "test-container-id", "root", "mkdir", "-p", "/.coder-agent").Return(nil, nil),
mCCLI.EXPECT().Copy(gomock.Any(), "test-container-id", coderBin, "/.coder-agent/coder").Return(nil),
mCCLI.EXPECT().ExecAs(gomock.Any(), "test-container-id", "root", "chmod", "+x", "/.coder-agent/coder").Return(nil, nil),
mCCLI.EXPECT().ExecAs(gomock.Any(), "test-container-id", "root", "chmod", "0755", "/.coder-agent", "/.coder-agent/coder").Return(nil, nil),
mCCLI.EXPECT().ExecAs(gomock.Any(), "test-container-id", "root", "chown", "0:0", "/.coder-agent", "/.coder-agent/coder").Return(nil, nil),
mCCLI.EXPECT().ExecAs(gomock.Any(), "test-container-id", "root", "setcap", "cap_net_admin+ep", "/.coder-agent/coder").Return(nil, nil),
)

Expand DownExpand Up@@ -1324,7 +1325,8 @@ func TestAPI(t *testing.T) {
mCCLI.EXPECT().DetectArchitecture(gomock.Any(), "test-container-id").Return(runtime.GOARCH, nil),
mCCLI.EXPECT().ExecAs(gomock.Any(), "test-container-id", "root", "mkdir", "-p", "/.coder-agent").Return(nil, nil),
mCCLI.EXPECT().Copy(gomock.Any(), "test-container-id", coderBin, "/.coder-agent/coder").Return(nil),
mCCLI.EXPECT().ExecAs(gomock.Any(), "test-container-id", "root", "chmod", "+x", "/.coder-agent/coder").Return(nil, nil),
mCCLI.EXPECT().ExecAs(gomock.Any(), "test-container-id", "root", "chmod", "0755", "/.coder-agent", "/.coder-agent/coder").Return(nil, nil),
mCCLI.EXPECT().ExecAs(gomock.Any(), "test-container-id", "root", "chown", "0:0", "/.coder-agent", "/.coder-agent/coder").Return(nil, nil),
mCCLI.EXPECT().ExecAs(gomock.Any(), "test-container-id", "root", "setcap", "cap_net_admin+ep", "/.coder-agent/coder").Return(nil, nil),
)

Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp