Skip to content

Commit 1b4157b

Browse files
committed
docs
1 parent 788b2f9 commit 1b4157b

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

agent/agent.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,8 +1115,13 @@ func (a *agent) handleManifest(manifestOK *checkpoint) func(ctx context.Context,
11151115
}
11161116
}
11171117

1118+
// Any defined Dev Containers may be autostarted after the start
1119+
// scripts have completed.
11181120
var postStartScripts []codersdk.WorkspaceAgentScript
11191121
for _, dc := range manifest.Devcontainers {
1122+
// TODO(mafredri): Verify `@devcontainers/cli` presence.
1123+
// TODO(mafredri): Verify workspace folder exists.
1124+
// TODO(mafredri): If set, verify config path exists.
11201125
postStartScripts = append(postStartScripts, agentcontainers.DevcontainerStartupScript(dc))
11211126
}
11221127

@@ -1126,11 +1131,18 @@ func (a *agent) handleManifest(manifestOK *checkpoint) func(ctx context.Context,
11261131
}
11271132
err = a.trackGoroutine(func() {
11281133
start := time.Now()
1129-
// here we use the graceful context because the script runner is not directly tied
1130-
// to the agent API.
1134+
// Here we use the graceful context because the script runner is
1135+
// not directly tied to the agent API.
1136+
//
1137+
// First we run the start scripts to ensure the workspace has
1138+
// been initialized and then the post start scripts which may
1139+
// depend on the workspace start scripts.
1140+
//
1141+
// Measure the time immediately after the start scripts have
1142+
// finished (both start and post start). For instance, an
1143+
// autostarted devcontainer will be included in this time.
11311144
err := a.scriptRunner.Execute(a.gracefulCtx, agentscripts.ExecuteStartScripts)
11321145
err = errors.Join(err, a.scriptRunner.Execute(a.gracefulCtx, agentscripts.ExecutePostStartScripts))
1133-
// Measure the time immediately after the script has finished
11341146
dur := time.Since(start).Seconds()
11351147
if err != nil {
11361148
a.logger.Warn(ctx, "startup script(s) failed", slog.Error(err))

0 commit comments

Comments
 (0)
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