Skip to content

Commit e918531

Browse files
committed
feat: add default_apps field to agent
1 parent 4e36f91 commit e918531

File tree

22 files changed

+417
-236
lines changed

22 files changed

+417
-236
lines changed

coderd/apidoc/docs.go

Lines changed: 23 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: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/dump.sql

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE workspace_agents DROP COLUMN default_apps;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE workspace_agents ADD column default_apps text[] DEFAULT NULL;

coderd/database/models.go

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

coderd/database/queries.sql.go

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

coderd/database/queries/workspaceagents.sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,11 @@ INSERT INTO
6060
startup_script_behavior,
6161
startup_script_timeout_seconds,
6262
shutdown_script,
63-
shutdown_script_timeout_seconds
63+
shutdown_script_timeout_seconds,
64+
default_apps
6465
)
6566
VALUES
66-
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21) RETURNING *;
67+
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22) RETURNING *;
6768

6869
-- name: UpdateWorkspaceAgentConnectionByID :exec
6970
UPDATE

coderd/provisionerdserver/provisionerdserver.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,6 +1212,7 @@ func InsertWorkspaceResource(ctx context.Context, db database.Store, jobID uuid.
12121212
Valid: prAgent.ShutdownScript != "",
12131213
},
12141214
ShutdownScriptTimeoutSeconds: prAgent.GetShutdownScriptTimeoutSeconds(),
1215+
DefaultApps: prAgent.DefaultApps,
12151216
})
12161217
if err != nil {
12171218
return xerrors.Errorf("insert agent: %w", err)

coderd/workspaceagents.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,6 +1330,7 @@ func convertWorkspaceAgent(derpMap *tailcfg.DERPMap, coordinator tailnet.Coordin
13301330
ShutdownScript: dbAgent.ShutdownScript.String,
13311331
ShutdownScriptTimeoutSeconds: dbAgent.ShutdownScriptTimeoutSeconds,
13321332
Subsystems: subsystems,
1333+
DefaultApps: convertDefaultApps(dbAgent.DefaultApps),
13331334
}
13341335
node := coordinator.Node(dbAgent.ID)
13351336
if node != nil {
@@ -1391,6 +1392,18 @@ func convertWorkspaceAgent(derpMap *tailcfg.DERPMap, coordinator tailnet.Coordin
13911392
return workspaceAgent, nil
13921393
}
13931394

1395+
func convertDefaultApps(apps []string) []codersdk.DefaultApp {
1396+
dapps := make([]codersdk.DefaultApp, 0, len(apps))
1397+
for _, app := range apps {
1398+
switch codersdk.DefaultApp(app) {
1399+
case codersdk.DefaultAppVSCodeDesktop, codersdk.DefaultAppVSCodeInsiders, codersdk.DefaultAppPortForward, codersdk.DefaultAppWebTerminal:
1400+
dapps = append(dapps, codersdk.DefaultApp(app))
1401+
}
1402+
}
1403+
1404+
return dapps
1405+
}
1406+
13941407
// @Summary Submit workspace agent stats
13951408
// @ID submit-workspace-agent-stats
13961409
// @Security CoderSessionToken

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy