Skip to content

feat: add workspace_apps configuration to control apps in workspace table #18922

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions coderd/database/dump.sql

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions coderd/database/migrations/000350_workspace_apps.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Remove workspace_apps column from workspace_agents table
ALTER TABLE workspace_agents DROP COLUMN workspace_apps;
4 changes: 4 additions & 0 deletions coderd/database/migrations/000350_workspace_apps.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- Add workspace_apps column to workspace_agents table
ALTER TABLE workspace_agents ADD COLUMN workspace_apps text[] DEFAULT NULL;

COMMENT ON COLUMN workspace_agents.workspace_apps IS 'List of app IDs to display in the workspace table, configured via terraform';
5 changes: 3 additions & 2 deletions coderd/database/models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions coderd/database/queries.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion coderd/database/queries/workspaceagents.sql
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,12 @@ INSERT INTO
troubleshooting_url,
motd_file,
display_apps,
workspace_apps,
display_order,
api_key_scope
)
VALUES
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20) RETURNING *;
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21) RETURNING *;

-- name: UpdateWorkspaceAgentConnectionByID :exec
UPDATE
Expand Down
1 change: 1 addition & 0 deletions coderd/provisionerdserver/provisionerdserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -2428,6 +2428,7 @@ func InsertWorkspaceResource(ctx context.Context, db database.Store, jobID uuid.
TroubleshootingURL: prAgent.GetTroubleshootingUrl(),
MOTDFile: prAgent.GetMotdFile(),
DisplayApps: convertDisplayApps(prAgent.GetDisplayApps()),
WorkspaceApps: prAgent.GetWorkspaceApps(),
InstanceMetadata: pqtype.NullRawMessage{},
ResourceMetadata: pqtype.NullRawMessage{},
// #nosec G115 - Order represents a display order value that's always small and fits in int32
Expand Down
1 change: 1 addition & 0 deletions codersdk/workspaceagents.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ type WorkspaceAgent struct {
Subsystems []AgentSubsystem `json:"subsystems"`
Health WorkspaceAgentHealth `json:"health"` // Health reports the health of the agent.
DisplayApps []DisplayApp `json:"display_apps"`
WorkspaceApps []string `json:"workspace_apps"`
LogSources []WorkspaceAgentLogSource `json:"log_sources"`
Scripts []WorkspaceAgentScript `json:"scripts"`

Expand Down
2 changes: 2 additions & 0 deletions provisioner/terraform/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ type agentAttributes struct {
MOTDFile string `mapstructure:"motd_file"`
Metadata []agentMetadata `mapstructure:"metadata"`
DisplayApps []agentDisplayAppsAttributes `mapstructure:"display_apps"`
WorkspaceApps []string `mapstructure:"workspace_apps"`
Order int64 `mapstructure:"order"`
ResourcesMonitoring []agentResourcesMonitoring `mapstructure:"resources_monitoring"`
}
Expand Down Expand Up @@ -348,6 +349,7 @@ func ConvertState(ctx context.Context, modules []*tfjson.StateModule, rawGraph s
ResourcesMonitoring: resourcesMonitoring,
Metadata: metadata,
DisplayApps: displayApps,
WorkspaceApps: attrs.WorkspaceApps,
Order: attrs.Order,
ApiKeyScope: attrs.APIKeyScope,
}
Expand Down
Loading
Loading