mirror of
https://github.com/coder/coder.git
synced 2026-10-28 02:42:54 +08:00
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:
@@ -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,
|
||||
})
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user