Skip to content

Commit a5ec3c4

Browse files
feat: add agent env flag to enable/disable project discovery
1 parent 225fe38 commit a5ec3c4

File tree

3 files changed

+28
-17
lines changed

3 files changed

+28
-17
lines changed

agent/agent.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,6 @@ func (a *agent) init() {
339339
containerAPIOpts := []agentcontainers.Option{
340340
agentcontainers.WithExecer(a.execer),
341341
agentcontainers.WithCommandEnv(a.sshServer.CommandEnv),
342-
agentcontainers.WithProjectDiscovery(true),
343342
agentcontainers.WithScriptLogger(func(logSourceID uuid.UUID) agentcontainers.ScriptLogger {
344343
return a.logSender.GetScriptLogger(logSourceID)
345344
}),

cli/agent.go

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,23 @@ import (
4040

4141
func (r *RootCmd) workspaceAgent() *serpent.Command {
4242
var (
43-
auth string
44-
logDir string
45-
scriptDataDir string
46-
pprofAddress string
47-
noReap bool
48-
sshMaxTimeout time.Duration
49-
tailnetListenPort int64
50-
prometheusAddress string
51-
debugAddress string
52-
slogHumanPath string
53-
slogJSONPath string
54-
slogStackdriverPath string
55-
blockFileTransfer bool
56-
agentHeaderCommand string
57-
agentHeader []string
58-
devcontainers bool
43+
auth string
44+
logDir string
45+
scriptDataDir string
46+
pprofAddress string
47+
noReap bool
48+
sshMaxTimeout time.Duration
49+
tailnetListenPort int64
50+
prometheusAddress string
51+
debugAddress string
52+
slogHumanPath string
53+
slogJSONPath string
54+
slogStackdriverPath string
55+
blockFileTransfer bool
56+
agentHeaderCommand string
57+
agentHeader []string
58+
devcontainers bool
59+
devcontainerProjectDiscovery bool
5960
)
6061
cmd := &serpent.Command{
6162
Use: "agent",
@@ -364,6 +365,7 @@ func (r *RootCmd) workspaceAgent() *serpent.Command {
364365
Devcontainers: devcontainers,
365366
DevcontainerAPIOptions: []agentcontainers.Option{
366367
agentcontainers.WithSubAgentURL(r.agentURL.String()),
368+
agentcontainers.WithProjectDiscovery(devcontainerProjectDiscovery),
367369
},
368370
})
369371

@@ -510,6 +512,13 @@ func (r *RootCmd) workspaceAgent() *serpent.Command {
510512
Description: "Allow the agent to automatically detect running devcontainers.",
511513
Value: serpent.BoolOf(&devcontainers),
512514
},
515+
{
516+
Flag: "devcontainers-project-discovery-enable",
517+
Default: "true",
518+
Env: "CODER_AGENT_DEVCONTAINERS_PROJECT_DISCOVERY_ENABLE",
519+
Description: "Allow the agent to search the filesystem for devcontainer projects.",
520+
Value: serpent.BoolOf(&devcontainerProjectDiscovery),
521+
},
513522
}
514523

515524
return cmd

cli/testdata/coder_agent_--help.golden

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ OPTIONS:
3636
--devcontainers-enable bool, $CODER_AGENT_DEVCONTAINERS_ENABLE (default: true)
3737
Allow the agent to automatically detect running devcontainers.
3838

39+
--devcontainers-project-discovery-enable bool, $CODER_AGENT_DEVCONTAINERS_PROJECT_DISCOVERY_ENABLE (default: true)
40+
Allow the agent to search the filesystem for devcontainer projects.
41+
3942
--log-dir string, $CODER_AGENT_LOG_DIR (default: /tmp)
4043
Specify the location for the agent log files.
4144

0 commit comments

Comments
 (0)