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

Commitc7cfa65

Browse files
authored
fix(enterprise): correct order for external agent init cmd (#19408)
### Description`CODER_AGENT_TOKEN` env variable was incorrectly being passed to thecurl command instead of the executed script during agent initialization.Fixed the command order to ensure `CODER_AGENT_TOKEN` is properly passedto the script execution context rather than the download command.
1 parent7f72067 commitc7cfa65

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

‎enterprise/coderd/workspaceagents.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func (api *API) workspaceExternalAgentCredentials(rw http.ResponseWriter, r *htt
8686
}
8787

8888
initScriptURL:=fmt.Sprintf("%s/api/v2/init-script/%s/%s",api.AccessURL.String(),agent.OperatingSystem,agent.Architecture)
89-
command:=fmt.Sprintf("CODER_AGENT_TOKEN=%qcurl -fsSL %q | sh",agent.AuthToken.String(),initScriptURL)
89+
command:=fmt.Sprintf("curl -fsSL %q |CODER_AGENT_TOKEN=%qsh",initScriptURL,agent.AuthToken.String())
9090
ifagent.OperatingSystem=="windows" {
9191
command=fmt.Sprintf("$env:CODER_AGENT_TOKEN=%q; iwr -useb %q | iex",agent.AuthToken.String(),initScriptURL)
9292
}

‎enterprise/coderd/workspaceagents_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ func TestWorkspaceExternalAgentCredentials(t *testing.T) {
385385
require.NoError(t,err)
386386

387387
require.Equal(t,r.AgentToken,credentials.AgentToken)
388-
expectedCommand:=fmt.Sprintf("CODER_AGENT_TOKEN=%qcurl -fsSL\"%s/api/v2/init-script/linux/amd64\" | sh",r.AgentToken,client.URL)
388+
expectedCommand:=fmt.Sprintf("curl -fsSL\"%s/api/v2/init-script/linux/amd64\" |CODER_AGENT_TOKEN=%qsh",client.URL,r.AgentToken)
389389
require.Equal(t,expectedCommand,credentials.Command)
390390
})
391391

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp