feat(agent): send devcontainer CLI logs during recreate (#17845)

We need a way to surface what's happening to the user, since autostart
logs here, it's natural we do so during re-create as well.

Updates #16424
This commit is contained in:
Mathias Fredriksson
2025-05-15 16:06:56 +03:00
committed by GitHub
parent 6e1ba75b06
commit 3de0003e4b
7 changed files with 342 additions and 25 deletions

View File

@ -7,6 +7,8 @@ import (
"github.com/go-chi/chi/v5"
"github.com/google/uuid"
"github.com/coder/coder/v2/agent/agentcontainers"
"github.com/coder/coder/v2/coderd/httpapi"
"github.com/coder/coder/v2/codersdk"
@ -40,12 +42,15 @@ func (a *agent) apiHandler() (http.Handler, func() error) {
if a.experimentalDevcontainersEnabled {
containerAPIOpts := []agentcontainers.Option{
agentcontainers.WithExecer(a.execer),
agentcontainers.WithScriptLogger(func(logSourceID uuid.UUID) agentcontainers.ScriptLogger {
return a.logSender.GetScriptLogger(logSourceID)
}),
}
manifest := a.manifest.Load()
if manifest != nil && len(manifest.Devcontainers) > 0 {
containerAPIOpts = append(
containerAPIOpts,
agentcontainers.WithDevcontainers(manifest.Devcontainers),
agentcontainers.WithDevcontainers(manifest.Devcontainers, manifest.Scripts),
)
}