feat: add name to workspace agent devcontainers (#17089)

In the presence of multiple devcontainers, it would be nice to
differentiate them by name. This change inherits the resource name from
terraform.

Refs #17076
This commit is contained in:
Mathias Fredriksson
2025-03-25 12:59:20 +00:00
committed by GitHub
parent 56082f3b83
commit 5c8cac9fb7
22 changed files with 808 additions and 748 deletions
+1
View File
@@ -614,6 +614,7 @@ func ConvertState(ctx context.Context, modules []*tfjson.StateModule, rawGraph s
continue
}
agent.Devcontainers = append(agent.Devcontainers, &proto.Devcontainer{
Name: resource.Name,
WorkspaceFolder: attrs.WorkspaceFolder,
ConfigPath: attrs.ConfigPath,
})
+3 -1
View File
@@ -845,9 +845,11 @@ func TestConvertResources(t *testing.T) {
ResourcesMonitoring: &proto.ResourcesMonitoring{},
Devcontainers: []*proto.Devcontainer{
{
Name: "dev1",
WorkspaceFolder: "/workspace1",
},
{
Name: "dev2",
WorkspaceFolder: "/workspace2",
ConfigPath: "/workspace2/.devcontainer/devcontainer.json",
},
@@ -1404,7 +1406,7 @@ func sortResources(resources []*proto.Resource) {
return agent.Scripts[i].DisplayName < agent.Scripts[j].DisplayName
})
sort.Slice(agent.Devcontainers, func(i, j int) bool {
return agent.Devcontainers[i].WorkspaceFolder < agent.Devcontainers[j].WorkspaceFolder
return agent.Devcontainers[i].Name < agent.Devcontainers[j].Name
})
}
sort.Slice(resource.Agents, func(i, j int) bool {