Skip to content

Commit baf3bf6

Browse files
szab100kylecarbsmatifali
authored
feat: add workspace_id, owner_name to agent manifest (#10199)
Co-authored-by: Kyle Carberry <kyle@carberry.com> Co-authored-by: Atif Ali <atif@coder.com>
1 parent 28eca2e commit baf3bf6

File tree

7 files changed

+46
-17
lines changed

7 files changed

+46
-17
lines changed

coderd/apidoc/docs.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/workspaceagents.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,8 @@ func (api *API) workspaceAgentManifest(rw http.ResponseWriter, r *http.Request)
237237

238238
httpapi.Write(ctx, rw, http.StatusOK, agentsdk.Manifest{
239239
AgentID: apiAgent.ID,
240+
OwnerName: owner.Username,
241+
WorkspaceID: workspace.ID,
240242
Apps: convertApps(dbApps, workspaceAgent, owner.Username, workspace),
241243
Scripts: convertScripts(scripts),
242244
DERPMap: api.DERPMap(),

coderd/workspaceagents_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,8 @@ func TestWorkspaceAgent_Metadata(t *testing.T) {
998998
require.NoError(t, err)
999999

10001000
// Verify manifest API response.
1001+
require.Equal(t, workspace.ID, manifest.WorkspaceID)
1002+
require.Equal(t, workspace.OwnerName, manifest.OwnerName)
10011003
require.Equal(t, "First Meta", manifest.Metadata[0].DisplayName)
10021004
require.Equal(t, "foo1", manifest.Metadata[0].Key)
10031005
require.Equal(t, "echo hi", manifest.Metadata[0].Script)

codersdk/agentsdk/agentsdk.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ func (c *Client) PostMetadata(ctx context.Context, req PostMetadataRequest) erro
9898

9999
type Manifest struct {
100100
AgentID uuid.UUID `json:"agent_id"`
101+
// OwnerName and WorkspaceID are used by an open-source user to identify the workspace.
102+
// We do not provide insurance that this will not be removed in the future,
103+
// but if it's easy to persist lets keep it around.
104+
OwnerName string `json:"owner_name"`
105+
WorkspaceID uuid.UUID `json:"workspace_id"`
101106
// GitAuthConfigs stores the number of Git configurations
102107
// the Coder deployment has. If this number is >0, we
103108
// set up special configuration in the workspace.

docs/api/agents.md

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/api/schemas.md

Lines changed: 20 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)