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

feat(agent/agentcontainers): add devcontainers list endpoint#17389

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

Conversation

mafredri
Copy link
Member

This change allows listing both predefined and runtime-detected
devcontainers, as well as showing whether or not the devcontainer is
running and which container represents it.

Fixescoder/internal#478


The intent here is to replace the currently used containers endpoint with this one as it provides more context on devcontainers, including ones that have not been started yet, or removed at some point.

This change allows listing both predefined and runtime-detecteddevcontainers, as well as showing whether or not the devcontainer isrunning and which container represents it.Fixescoder/internal#478
@@ -121,12 +148,11 @@ func (api *API) getContainers(ctx context.Context) (codersdk.WorkspaceAgentListC
select {
case <-ctx.Done():
return codersdk.WorkspaceAgentListContainersResponse{}, ctx.Err()
default:
api.lockCh <- struct{}{}
case api.lockCh <- struct{}{}:
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Review: Drive-by bug fix.

@@ -158,7 +234,7 @@ func (api *API) handleRecreate(w http.ResponseWriter, r *http.Request) {
return
}

containers, err := api.cl.List(ctx)
containers, err := api.getContainers(ctx)
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Review: Drive-by bug fix.

johnstcn reacted with thumbs up emoji
lockCh chan struct{}
containers codersdk.WorkspaceAgentListContainersResponse
mtime time.Time

devcontainersMu sync.Mutex // Protects following.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Do we need a separate mutex here? Can we not reuselockCh?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It's not as ergonomic but sure, switched to it 😄


// Check if the container is running and update the known devcontainers.
for _, container := range updated.Containers {
workspaceFolder := container.Labels[DevcontainerLocalFolderLabel]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

thought, non-blocking: Given that aWorkspaceAgentDevcontainer is a superset of aWorkspaceAgentContainer, I wonder if we could instead store the optional devcontainer-specific fields inWorkspaceAgentContainer?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The main issue with that approach is: how do we represent a devcontainer we know about but that has no container? (I.e. either it wasn't started, or it was deleted.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Gotcha 👍

Copy link
Contributor

@DanielleMaywoodDanielleMaywood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

looks good to me

@mafredrimafredri merged commit00b5f56 intomainApr 15, 2025
30 of 32 checks passed
@mafredrimafredri deleted the mafredri/feat-agent-agentcontainers-add-devcontainers-endpoint branchApril 15, 2025 14:53
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsApr 15, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@johnstcnjohnstcnjohnstcn approved these changes

@DanielleMaywoodDanielleMaywoodDanielleMaywood approved these changes

@defelmnqdefelmnqAwaiting requested review from defelmnq

Assignees

@mafredrimafredri

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

agent: implement the capability to list devcontainer config file paths relevant to all running devcontainers
3 participants
@mafredri@johnstcn@DanielleMaywood

[8]ページ先頭

©2009-2025 Movatter.jp