From c48cfee5a6ae945e482929df6316e8f26ee6bdc8 Mon Sep 17 00:00:00 2001 From: Kacper Sawicki Date: Tue, 19 Aug 2025 10:38:49 +0000 Subject: [PATCH 1/2] fix(coderd): correct command order for agent initialization script execution --- enterprise/coderd/workspaceagents.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/enterprise/coderd/workspaceagents.go b/enterprise/coderd/workspaceagents.go index 0e32d550232f5..739aba6d628c2 100644 --- a/enterprise/coderd/workspaceagents.go +++ b/enterprise/coderd/workspaceagents.go @@ -86,7 +86,7 @@ func (api *API) workspaceExternalAgentCredentials(rw http.ResponseWriter, r *htt } initScriptURL := fmt.Sprintf("%s/api/v2/init-script/%s/%s", api.AccessURL.String(), agent.OperatingSystem, agent.Architecture) - command := fmt.Sprintf("CODER_AGENT_TOKEN=%q curl -fsSL %q | sh", agent.AuthToken.String(), initScriptURL) + command := fmt.Sprintf("curl -fsSL %q | CODER_AGENT_TOKEN=%q sh", initScriptURL, agent.AuthToken.String()) if agent.OperatingSystem == "windows" { command = fmt.Sprintf("$env:CODER_AGENT_TOKEN=%q; iwr -useb %q | iex", agent.AuthToken.String(), initScriptURL) } From 813824a30cd1618ee124e6710e4ed768daef9e66 Mon Sep 17 00:00:00 2001 From: Kacper Sawicki Date: Tue, 19 Aug 2025 10:50:28 +0000 Subject: [PATCH 2/2] Fix test --- enterprise/coderd/workspaceagents_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/enterprise/coderd/workspaceagents_test.go b/enterprise/coderd/workspaceagents_test.go index f7884ef1a66c6..c9d44e667c212 100644 --- a/enterprise/coderd/workspaceagents_test.go +++ b/enterprise/coderd/workspaceagents_test.go @@ -385,7 +385,7 @@ func TestWorkspaceExternalAgentCredentials(t *testing.T) { require.NoError(t, err) require.Equal(t, r.AgentToken, credentials.AgentToken) - expectedCommand := fmt.Sprintf("CODER_AGENT_TOKEN=%q curl -fsSL \"%s/api/v2/init-script/linux/amd64\" | sh", r.AgentToken, client.URL) + expectedCommand := fmt.Sprintf("curl -fsSL \"%s/api/v2/init-script/linux/amd64\" | CODER_AGENT_TOKEN=%q sh", client.URL, r.AgentToken) require.Equal(t, expectedCommand, credentials.Command) }) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy