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

Commit86f68b2

Browse files
feat: add 'display_name' column to 'workspace_agent_scripts' (#14747)
* feat: add 'display_name' column to 'workspace_agent_scripts'* fix: backfill from workspace_agent_log_sources* fix: run 'make gen'
1 parentdb7b411 commit86f68b2

22 files changed

+419
-348
lines changed

‎agent/proto/agent.pb.go

Lines changed: 351 additions & 341 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎agent/proto/agent.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ message WorkspaceAgentScript {
5353
boolrun_on_stop=6;
5454
boolstart_blocks_login=7;
5555
google.protobuf.Durationtimeout=8;
56+
stringdisplay_name=9;
5657
}
5758

5859
messageWorkspaceAgentMetadata {

‎coderd/apidoc/docs.go

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

‎coderd/apidoc/swagger.json

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

‎coderd/database/dump.sql

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTERTABLE workspace_agent_scripts DROP COLUMN display_name;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
ALTERTABLE workspace_agent_scripts ADD COLUMN display_nametext;
2+
3+
UPDATE workspace_agent_scripts
4+
SET display_name=workspace_agent_log_sources.display_name
5+
FROM workspace_agent_log_sources
6+
WHEREworkspace_agent_scripts.log_source_id=workspace_agent_log_sources.id;
7+
8+
ALTERTABLE workspace_agent_scripts ALTER COLUMN display_nameSETNOT NULL;

‎coderd/database/models.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/queries.sql.go

Lines changed: 9 additions & 4 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/queries/workspacescripts.sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- name: InsertWorkspaceAgentScripts :many
22
INSERT INTO
3-
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)
3+
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)
44
SELECT
55
@workspace_agent_id :: uuidAS workspace_agent_id,
66
@created_at ::timestamptzAS created_at,
@@ -11,7 +11,8 @@ SELECT
1111
unnest(@start_blocks_login ::boolean [ ])AS start_blocks_login,
1212
unnest(@run_on_start ::boolean [ ])AS run_on_start,
1313
unnest(@run_on_stop ::boolean [ ])AS run_on_stop,
14-
unnest(@timeout_seconds ::integer [ ])AS timeout_seconds
14+
unnest(@timeout_seconds ::integer [ ])AS timeout_seconds,
15+
unnest(@display_name ::text [ ])AS display_name
1516
RETURNING workspace_agent_scripts.*;
1617

1718
-- name: GetWorkspaceAgentScriptsByAgentIDs :many

‎coderd/provisionerdserver/provisionerdserver.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1818,6 +1818,7 @@ func InsertWorkspaceResource(ctx context.Context, db database.Store, jobID uuid.
18181818
logSourceIDs:=make([]uuid.UUID,0,len(prAgent.Scripts))
18191819
logSourceDisplayNames:=make([]string,0,len(prAgent.Scripts))
18201820
logSourceIcons:=make([]string,0,len(prAgent.Scripts))
1821+
scriptDisplayName:=make([]string,0,len(prAgent.Scripts))
18211822
scriptLogPaths:=make([]string,0,len(prAgent.Scripts))
18221823
scriptSources:=make([]string,0,len(prAgent.Scripts))
18231824
scriptCron:=make([]string,0,len(prAgent.Scripts))
@@ -1830,6 +1831,7 @@ func InsertWorkspaceResource(ctx context.Context, db database.Store, jobID uuid.
18301831
logSourceIDs=append(logSourceIDs,uuid.New())
18311832
logSourceDisplayNames=append(logSourceDisplayNames,script.DisplayName)
18321833
logSourceIcons=append(logSourceIcons,script.Icon)
1834+
scriptDisplayName=append(scriptDisplayName,script.DisplayName)
18331835
scriptLogPaths=append(scriptLogPaths,script.LogPath)
18341836
scriptSources=append(scriptSources,script.Script)
18351837
scriptCron=append(scriptCron,script.Cron)
@@ -1861,6 +1863,7 @@ func InsertWorkspaceResource(ctx context.Context, db database.Store, jobID uuid.
18611863
StartBlocksLogin:scriptStartBlocksLogin,
18621864
RunOnStart:scriptRunOnStart,
18631865
RunOnStop:scriptRunOnStop,
1866+
DisplayName:scriptDisplayName,
18641867
})
18651868
iferr!=nil {
18661869
returnxerrors.Errorf("insert agent scripts: %w",err)

‎coderd/workspaceagents.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -977,6 +977,7 @@ func convertScripts(dbScripts []database.WorkspaceAgentScript) []codersdk.Worksp
977977
RunOnStop:dbScript.RunOnStop,
978978
StartBlocksLogin:dbScript.StartBlocksLogin,
979979
Timeout:time.Duration(dbScript.TimeoutSeconds)*time.Second,
980+
DisplayName:dbScript.DisplayName,
980981
})
981982
}
982983
returnscripts

‎codersdk/agentsdk/convert.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ func AgentScriptFromProto(protoScript *proto.WorkspaceAgentScript) (codersdk.Wor
172172
RunOnStop:protoScript.RunOnStop,
173173
StartBlocksLogin:protoScript.StartBlocksLogin,
174174
Timeout:protoScript.Timeout.AsDuration(),
175+
DisplayName:protoScript.DisplayName,
175176
},nil
176177
}
177178

@@ -185,6 +186,7 @@ func ProtoFromScript(s codersdk.WorkspaceAgentScript) *proto.WorkspaceAgentScrip
185186
RunOnStop:s.RunOnStop,
186187
StartBlocksLogin:s.StartBlocksLogin,
187188
Timeout:durationpb.New(s.Timeout),
189+
DisplayName:s.DisplayName,
188190
}
189191
}
190192

‎codersdk/agentsdk/convert_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ func TestManifest(t *testing.T) {
114114
RunOnStop:true,
115115
StartBlocksLogin:true,
116116
Timeout:time.Second,
117+
DisplayName:"foo",
117118
},
118119
{
119120
LogSourceID:uuid.New(),
@@ -124,6 +125,7 @@ func TestManifest(t *testing.T) {
124125
RunOnStop:true,
125126
StartBlocksLogin:true,
126127
Timeout:time.Second*4,
128+
DisplayName:"bar",
127129
},
128130
},
129131
}

‎codersdk/workspaceagents.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ type WorkspaceAgentScript struct {
193193
RunOnStopbool`json:"run_on_stop"`
194194
StartBlocksLoginbool`json:"start_blocks_login"`
195195
Timeout time.Duration`json:"timeout"`
196+
DisplayNamestring`json:"display_name"`
196197
}
197198

198199
typeWorkspaceAgentHealthstruct {

‎docs/reference/api/agents.md

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎docs/reference/api/builds.md

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

‎docs/reference/api/schemas.md

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp