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

Commite9b3561

Browse files
refactor: return template_icon and make metadata required (#16496)
1 parent0b4d2cf commite9b3561

19 files changed

+98
-30
lines changed

‎cli/testdata/coder_list_--output_json.golden

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,14 @@
4848
"input": {
4949
"workspace_build_id": "========[workspace build ID]========"
5050
},
51-
"type": "workspace_build"
51+
"type": "workspace_build",
52+
"metadata": {
53+
"template_version_name": "",
54+
"template_id": "00000000-0000-0000-0000-000000000000",
55+
"template_name": "",
56+
"template_display_name": "",
57+
"template_icon": ""
58+
}
5259
},
5360
"reason": "initiator",
5461
"resources": [],

‎cli/testdata/coder_provisioner_jobs_list_--help.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ OPTIONS:
1111
-O, --org string, $CODER_ORGANIZATION
1212
Select which organization (uuid or name) to use.
1313

14-
-c, --column [id|created at|started at|completed at|canceled at|error|error code|status|worker id|file id|tags|queue position|queue size|organization id|template version id|workspace build id|type|available workers|template version name|template id|template name|template display name|workspace id|workspace name|organization|queue] (default: created at,id,organization,status,type,queue,tags)
14+
-c, --column [id|created at|started at|completed at|canceled at|error|error code|status|worker id|file id|tags|queue position|queue size|organization id|template version id|workspace build id|type|available workers|template version name|template id|template name|template display name|template icon|workspace id|workspace name|organization|queue] (default: created at,id,organization,status,type,queue,tags)
1515
Columns to display in table output.
1616

1717
-l, --limit int, $CODER_PROVISIONER_JOB_LIST_LIMIT (default: 50)

‎cli/testdata/coder_provisioner_jobs_list_--output_json.golden

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"template_version_name": "===========[version name]===========",
2323
"template_id": "===========[template ID]============",
2424
"template_name": "test-template",
25-
"template_display_name": ""
25+
"template_display_name": "",
26+
"template_icon": ""
2627
},
2728
"organization_name": "Coder"
2829
},
@@ -50,6 +51,7 @@
5051
"template_id": "===========[template ID]============",
5152
"template_name": "test-template",
5253
"template_display_name": "",
54+
"template_icon": "",
5355
"workspace_id": "===========[workspace ID]===========",
5456
"workspace_name": "test-workspace"
5557
},

‎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/queries.sql.go

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

‎coderd/database/queries/provisionerjobs.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ SELECT
136136
t.idAS template_id,
137137
COALESCE(t.name,'')AS template_name,
138138
COALESCE(t.display_name,'')AS template_display_name,
139+
COALESCE(t.icon,'')AS template_icon,
139140
w.idAS workspace_id,
140141
COALESCE(w.name,'')AS workspace_name
141142
FROM
@@ -165,6 +166,7 @@ GROUP BY
165166
t.id,
166167
t.name,
167168
t.display_name,
169+
t.icon,
168170
w.id,
169171
w.name
170172
ORDER BY

‎coderd/provisionerjobs.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,11 +388,12 @@ func convertProvisionerJobWithQueuePosition(pj database.GetProvisionerJobsByOrga
388388
QueueSize:pj.QueueSize,
389389
})
390390
job.AvailableWorkers=pj.AvailableWorkers
391-
job.Metadata=&codersdk.ProvisionerJobMetadata{
391+
job.Metadata= codersdk.ProvisionerJobMetadata{
392392
TemplateVersionName:pj.TemplateVersionName,
393393
TemplateID:pj.TemplateID.UUID,
394394
TemplateName:pj.TemplateName,
395395
TemplateDisplayName:pj.TemplateDisplayName,
396+
TemplateIcon:pj.TemplateIcon,
396397
WorkspaceName:pj.WorkspaceName,
397398
}
398399
ifpj.WorkspaceID.Valid {

‎coderd/provisionerjobs_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,12 @@ func TestProvisionerJobs(t *testing.T) {
8484
require.Equal(t,job.ID,job2.ID)
8585

8686
// Verify that job metadata is correct.
87-
assert.Equal(t,job2.Metadata,&codersdk.ProvisionerJobMetadata{
87+
assert.Equal(t,job2.Metadata, codersdk.ProvisionerJobMetadata{
8888
TemplateVersionName:version.Name,
8989
TemplateID:template.ID,
9090
TemplateName:template.Name,
9191
TemplateDisplayName:template.DisplayName,
92+
TemplateIcon:template.Icon,
9293
WorkspaceID:&w.ID,
9394
WorkspaceName:w.Name,
9495
})
@@ -105,11 +106,12 @@ func TestProvisionerJobs(t *testing.T) {
105106
require.Equal(t,version.Job.ID,job2.ID)
106107

107108
// Verify that job metadata is correct.
108-
assert.Equal(t,job2.Metadata,&codersdk.ProvisionerJobMetadata{
109+
assert.Equal(t,job2.Metadata, codersdk.ProvisionerJobMetadata{
109110
TemplateVersionName:version.Name,
110111
TemplateID:template.ID,
111112
TemplateName:template.Name,
112113
TemplateDisplayName:template.DisplayName,
114+
TemplateIcon:template.Icon,
113115
})
114116
})
115117
})

‎codersdk/provisionerdaemons.go

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ type ProvisionerJobMetadata struct {
137137
TemplateID uuid.UUID`json:"template_id" format:"uuid" table:"template id"`
138138
TemplateNamestring`json:"template_name" table:"template name"`
139139
TemplateDisplayNamestring`json:"template_display_name" table:"template display name"`
140+
TemplateIconstring`json:"template_icon" table:"template icon"`
140141
WorkspaceID*uuid.UUID`json:"workspace_id,omitempty" format:"uuid" table:"workspace id"`
141142
WorkspaceNamestring`json:"workspace_name,omitempty" table:"workspace name"`
142143
}
@@ -165,24 +166,24 @@ func JobIsMissingParameterErrorCode(code JobErrorCode) bool {
165166

166167
// ProvisionerJob describes the job executed by the provisioning daemon.
167168
typeProvisionerJobstruct {
168-
ID uuid.UUID`json:"id" format:"uuid" table:"id"`
169-
CreatedAt time.Time`json:"created_at" format:"date-time" table:"created at"`
170-
StartedAt*time.Time`json:"started_at,omitempty" format:"date-time" table:"started at"`
171-
CompletedAt*time.Time`json:"completed_at,omitempty" format:"date-time" table:"completed at"`
172-
CanceledAt*time.Time`json:"canceled_at,omitempty" format:"date-time" table:"canceled at"`
173-
Errorstring`json:"error,omitempty" table:"error"`
174-
ErrorCodeJobErrorCode`json:"error_code,omitempty" enums:"REQUIRED_TEMPLATE_VARIABLES" table:"error code"`
175-
StatusProvisionerJobStatus`json:"status" enums:"pending,running,succeeded,canceling,canceled,failed" table:"status"`
176-
WorkerID*uuid.UUID`json:"worker_id,omitempty" format:"uuid" table:"worker id"`
177-
FileID uuid.UUID`json:"file_id" format:"uuid" table:"file id"`
178-
Tagsmap[string]string`json:"tags" table:"tags"`
179-
QueuePositionint`json:"queue_position" table:"queue position"`
180-
QueueSizeint`json:"queue_size" table:"queue size"`
181-
OrganizationID uuid.UUID`json:"organization_id" format:"uuid" table:"organization id"`
182-
InputProvisionerJobInput`json:"input" table:"input,recursive_inline"`
183-
TypeProvisionerJobType`json:"type" table:"type"`
184-
AvailableWorkers []uuid.UUID`json:"available_workers,omitempty" format:"uuid" table:"available workers"`
185-
Metadata*ProvisionerJobMetadata`json:"metadata,omitempty" table:"metadata,recursive_inline"`
169+
ID uuid.UUID`json:"id" format:"uuid" table:"id"`
170+
CreatedAt time.Time`json:"created_at" format:"date-time" table:"created at"`
171+
StartedAt*time.Time`json:"started_at,omitempty" format:"date-time" table:"started at"`
172+
CompletedAt*time.Time`json:"completed_at,omitempty" format:"date-time" table:"completed at"`
173+
CanceledAt*time.Time`json:"canceled_at,omitempty" format:"date-time" table:"canceled at"`
174+
Errorstring`json:"error,omitempty" table:"error"`
175+
ErrorCodeJobErrorCode`json:"error_code,omitempty" enums:"REQUIRED_TEMPLATE_VARIABLES" table:"error code"`
176+
StatusProvisionerJobStatus`json:"status" enums:"pending,running,succeeded,canceling,canceled,failed" table:"status"`
177+
WorkerID*uuid.UUID`json:"worker_id,omitempty" format:"uuid" table:"worker id"`
178+
FileID uuid.UUID`json:"file_id" format:"uuid" table:"file id"`
179+
Tagsmap[string]string`json:"tags" table:"tags"`
180+
QueuePositionint`json:"queue_position" table:"queue position"`
181+
QueueSizeint`json:"queue_size" table:"queue size"`
182+
OrganizationID uuid.UUID`json:"organization_id" format:"uuid" table:"organization id"`
183+
InputProvisionerJobInput`json:"input" table:"input,recursive_inline"`
184+
TypeProvisionerJobType`json:"type" table:"type"`
185+
AvailableWorkers []uuid.UUID`json:"available_workers,omitempty" format:"uuid" table:"available workers"`
186+
MetadataProvisionerJobMetadata`json:"metadata" table:"metadata,recursive_inline"`
186187
}
187188

188189
// ProvisionerJobLog represents the provisioner log entry annotated with source and level.

‎docs/reference/api/builds.md

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

‎docs/reference/api/organizations.md

Lines changed: 3 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