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

fix(agent/agentcontainers): reflect status for autostarted devcontainers#18463

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
mafredri wants to merge1 commit intomain
base:main
Choose a base branch
Loading
frommafredri/fix-devcontainer-autostart-starting
Draft
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletionsagent/agentcontainers/api.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -72,6 +72,7 @@ type API struct {
closed bool
containers codersdk.WorkspaceAgentListContainersResponse // Output from the last list operation.
containersErr error // Error from the last list operation.
autostartDevcontainer map[string]bool // Tracks workspace folder.
devcontainerNames map[string]bool // By devcontainer name.
knownDevcontainers map[string]codersdk.WorkspaceAgentDevcontainer // By workspace folder.
configFileModifiedTimes map[string]time.Time // By config file path.
Expand DownExpand Up@@ -178,6 +179,11 @@ func WithDevcontainers(devcontainers []codersdk.WorkspaceAgentDevcontainer, scri
api.devcontainerNames = make(map[string]bool, len(devcontainers))
api.devcontainerLogSourceIDs = make(map[string]uuid.UUID)
for _, dc := range devcontainers {
// Assumption: given devcontainers will be autostarted by the agent.
api.autostartDevcontainer[dc.WorkspaceFolder] = true
// Set starting to reflect status (and act as lock, see recreate).
dc.Status = codersdk.WorkspaceAgentDevcontainerStatusStarting

api.knownDevcontainers[dc.WorkspaceFolder] = dc
api.devcontainerNames[dc.Name] = true
for _, script := range scripts {
Expand DownExpand Up@@ -592,6 +598,12 @@ func (api *API) processUpdatedContainersLocked(ctx context.Context, updated code
}
}

if len(api.autostartDevcontainer) > 0 && dc.Status == codersdk.WorkspaceAgentDevcontainerStatusStarting && dc.Container != nil && api.autostartDevcontainer[dc.WorkspaceFolder] {
delete(api.autostartDevcontainer, dc.WorkspaceFolder)
// Unlock the devcontainer status so that it can be updated.
dc.Status = codersdk.WorkspaceAgentDevcontainerStatusStopped
}

switch {
case dc.Status == codersdk.WorkspaceAgentDevcontainerStatusStarting:
continue // This state is handled by the recreation routine.
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp