Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add 'display_name' column to 'workspace_agent_scripts'#14747

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
DanielleMaywood merged 3 commits intomainfromdm-add-display-name-to-script-table
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes fromall 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
692 changes: 351 additions & 341 deletionsagent/proto/agent.pb.go
View file
Open in desktop

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletionsagent/proto/agent.proto
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -53,6 +53,7 @@ message WorkspaceAgentScript {
bool run_on_stop = 6;
bool start_blocks_login = 7;
google.protobuf.Duration timeout = 8;
string display_name = 9;
}

message WorkspaceAgentMetadata {
Expand Down
3 changes: 3 additions & 0 deletionscoderd/apidoc/docs.go
View file
Open in desktop

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

3 changes: 3 additions & 0 deletionscoderd/apidoc/swagger.json
View file
Open in desktop

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

3 changes: 2 additions & 1 deletioncoderd/database/dump.sql
View file
Open in desktop

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

Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
ALTER TABLE workspace_agent_scripts DROP COLUMN display_name;
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
ALTER TABLE workspace_agent_scripts ADD COLUMN display_name text;

UPDATE workspace_agent_scripts
SET display_name = workspace_agent_log_sources.display_name
FROM workspace_agent_log_sources
WHERE workspace_agent_scripts.log_source_id = workspace_agent_log_sources.id;

ALTER TABLE workspace_agent_scripts ALTER COLUMN display_name SET NOT NULL;
1 change: 1 addition & 0 deletionscoderd/database/models.go
View file
Open in desktop

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

13 changes: 9 additions & 4 deletionscoderd/database/queries.sql.go
View file
Open in desktop

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

5 changes: 3 additions & 2 deletionscoderd/database/queries/workspacescripts.sql
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
-- name: InsertWorkspaceAgentScripts :many
INSERT INTO
workspace_agent_scripts (workspace_agent_id, created_at, log_source_id, log_path, script, cron, start_blocks_login, run_on_start, run_on_stop, timeout_seconds)
workspace_agent_scripts (workspace_agent_id, created_at, log_source_id, log_path, script, cron, start_blocks_login, run_on_start, run_on_stop, timeout_seconds, display_name)
SELECT
@workspace_agent_id :: uuid AS workspace_agent_id,
@created_at :: timestamptz AS created_at,
Expand All@@ -11,7 +11,8 @@ SELECT
unnest(@start_blocks_login :: boolean [ ]) AS start_blocks_login,
unnest(@run_on_start :: boolean [ ]) AS run_on_start,
unnest(@run_on_stop :: boolean [ ]) AS run_on_stop,
unnest(@timeout_seconds :: integer [ ]) AS timeout_seconds
unnest(@timeout_seconds :: integer [ ]) AS timeout_seconds,
unnest(@display_name :: text [ ]) AS display_name
RETURNING workspace_agent_scripts.*;

-- name: GetWorkspaceAgentScriptsByAgentIDs :many
Expand Down
3 changes: 3 additions & 0 deletionscoderd/provisionerdserver/provisionerdserver.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1818,6 +1818,7 @@ func InsertWorkspaceResource(ctx context.Context, db database.Store, jobID uuid.
logSourceIDs := make([]uuid.UUID, 0, len(prAgent.Scripts))
logSourceDisplayNames := make([]string, 0, len(prAgent.Scripts))
logSourceIcons := make([]string, 0, len(prAgent.Scripts))
scriptDisplayName := make([]string, 0, len(prAgent.Scripts))
scriptLogPaths := make([]string, 0, len(prAgent.Scripts))
scriptSources := make([]string, 0, len(prAgent.Scripts))
scriptCron := make([]string, 0, len(prAgent.Scripts))
Expand All@@ -1830,6 +1831,7 @@ func InsertWorkspaceResource(ctx context.Context, db database.Store, jobID uuid.
logSourceIDs = append(logSourceIDs, uuid.New())
logSourceDisplayNames = append(logSourceDisplayNames, script.DisplayName)
logSourceIcons = append(logSourceIcons, script.Icon)
scriptDisplayName = append(scriptDisplayName, script.DisplayName)
scriptLogPaths = append(scriptLogPaths, script.LogPath)
scriptSources = append(scriptSources, script.Script)
scriptCron = append(scriptCron, script.Cron)
Expand DownExpand Up@@ -1861,6 +1863,7 @@ func InsertWorkspaceResource(ctx context.Context, db database.Store, jobID uuid.
StartBlocksLogin: scriptStartBlocksLogin,
RunOnStart: scriptRunOnStart,
RunOnStop: scriptRunOnStop,
DisplayName: scriptDisplayName,
})
if err != nil {
return xerrors.Errorf("insert agent scripts: %w", err)
Expand Down
1 change: 1 addition & 0 deletionscoderd/workspaceagents.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -977,6 +977,7 @@ func convertScripts(dbScripts []database.WorkspaceAgentScript) []codersdk.Worksp
RunOnStop: dbScript.RunOnStop,
StartBlocksLogin: dbScript.StartBlocksLogin,
Timeout: time.Duration(dbScript.TimeoutSeconds) * time.Second,
DisplayName: dbScript.DisplayName,
})
}
return scripts
Expand Down
2 changes: 2 additions & 0 deletionscodersdk/agentsdk/convert.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -172,6 +172,7 @@ func AgentScriptFromProto(protoScript *proto.WorkspaceAgentScript) (codersdk.Wor
RunOnStop: protoScript.RunOnStop,
StartBlocksLogin: protoScript.StartBlocksLogin,
Timeout: protoScript.Timeout.AsDuration(),
DisplayName: protoScript.DisplayName,
}, nil
}

Expand All@@ -185,6 +186,7 @@ func ProtoFromScript(s codersdk.WorkspaceAgentScript) *proto.WorkspaceAgentScrip
RunOnStop: s.RunOnStop,
StartBlocksLogin: s.StartBlocksLogin,
Timeout: durationpb.New(s.Timeout),
DisplayName: s.DisplayName,
}
}

Expand Down
2 changes: 2 additions & 0 deletionscodersdk/agentsdk/convert_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -114,6 +114,7 @@ func TestManifest(t *testing.T) {
RunOnStop: true,
StartBlocksLogin: true,
Timeout: time.Second,
DisplayName: "foo",
},
{
LogSourceID: uuid.New(),
Expand All@@ -124,6 +125,7 @@ func TestManifest(t *testing.T) {
RunOnStop: true,
StartBlocksLogin: true,
Timeout: time.Second * 4,
DisplayName: "bar",
},
},
}
Expand Down
1 change: 1 addition & 0 deletionscodersdk/workspaceagents.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -193,6 +193,7 @@ type WorkspaceAgentScript struct {
RunOnStop bool `json:"run_on_stop"`
StartBlocksLogin bool `json:"start_blocks_login"`
Timeout time.Duration `json:"timeout"`
DisplayName string `json:"display_name"`
}

type WorkspaceAgentHealth struct {
Expand Down
1 change: 1 addition & 0 deletionsdocs/reference/api/agents.md
View file
Open in desktop

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

8 changes: 8 additions & 0 deletionsdocs/reference/api/builds.md
View file
Open in desktop

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

7 changes: 7 additions & 0 deletionsdocs/reference/api/schemas.md
View file
Open in desktop

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

Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp