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 provisioner daemon name to provisioner jobs responses#17877

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
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
8 commits
Select commitHold shift + click to select a range
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
2 changes: 1 addition & 1 deletioncli/testdata/coder_provisioner_jobs_list_--help.golden
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,7 +11,7 @@ OPTIONS:
-O, --org string, $CODER_ORGANIZATION
Select which organization (uuid or name) to use.

-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,type,template display name,status,queue,tags)
-c, --column [id|created at|started at|completed at|canceled at|error|error code|status|worker id|worker name|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,type,template display name,status,queue,tags)
Columns to display in table output.

-l, --limit int, $CODER_PROVISIONER_JOB_LIST_LIMIT (default: 50)
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,6 +6,7 @@
"completed_at": "====[timestamp]=====",
"status": "succeeded",
"worker_id": "====[workspace build worker ID]=====",
"worker_name": "test-daemon",
"file_id": "=====[workspace build file ID]======",
"tags": {
"owner": "",
Expand DownExpand Up@@ -34,6 +35,7 @@
"completed_at": "====[timestamp]=====",
"status": "succeeded",
"worker_id": "====[workspace build worker ID]=====",
"worker_name": "test-daemon",
"file_id": "=====[workspace build file ID]======",
"tags": {
"owner": "",
Expand Down
4 changes: 2 additions & 2 deletionscli/testdata/coder_provisioner_list.golden
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
CREATED AT LAST SEEN AT KEY NAME NAME VERSION STATUS TAGS
====[timestamp]===== ====[timestamp]===== built-in test v0.0.0-devel idle map[owner: scope:organization]
CREATED AT LAST SEEN AT KEY NAME NAMEVERSION STATUS TAGS
====[timestamp]===== ====[timestamp]===== built-in test-daemon v0.0.0-devel idle map[owner: scope:organization]
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,7 +5,7 @@
"key_id": "00000000-0000-0000-0000-000000000001",
"created_at": "====[timestamp]=====",
"last_seen_at": "====[timestamp]=====",
"name": "test",
"name": "test-daemon",
"version": "v0.0.0-devel",
"api_version": "1.6",
"provisioners": [
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.

6 changes: 4 additions & 2 deletionscoderd/coderdtest/coderdtest.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -96,6 +96,8 @@ import (
"github.com/coder/coder/v2/testutil"
)

const defaultTestDaemonName = "test-daemon"

type Options struct {
// AccessURL denotes a custom access URL. By default we use the httptest
// server's URL. Setting this may result in unexpected behavior (especially
Expand DownExpand Up@@ -602,7 +604,7 @@ func NewWithAPI(t testing.TB, options *Options) (*codersdk.Client, io.Closer, *c
setHandler(rootHandler)
var provisionerCloser io.Closer = nopcloser{}
if options.IncludeProvisionerDaemon {
provisionerCloser = NewTaggedProvisionerDaemon(t, coderAPI,"test", options.ProvisionerDaemonTags, coderd.MemoryProvisionerWithVersionOverride(options.ProvisionerDaemonVersion))
provisionerCloser = NewTaggedProvisionerDaemon(t, coderAPI,defaultTestDaemonName, options.ProvisionerDaemonTags, coderd.MemoryProvisionerWithVersionOverride(options.ProvisionerDaemonVersion))
}
client := codersdk.New(serverURL)
t.Cleanup(func() {
Expand DownExpand Up@@ -646,7 +648,7 @@ func (c *ProvisionerdCloser) Close() error {
// well with coderd testing. It registers the "echo" provisioner for
// quick testing.
func NewProvisionerDaemon(t testing.TB, coderAPI *coderd.API) io.Closer {
return NewTaggedProvisionerDaemon(t, coderAPI,"test", nil)
return NewTaggedProvisionerDaemon(t, coderAPI,defaultTestDaemonName, nil)
}

func NewTaggedProvisionerDaemon(t testing.TB, coderAPI *coderd.API, name string, provisionerTags map[string]string, opts ...coderd.MemoryProvisionerDaemonOption) io.Closer {
Expand Down
7 changes: 7 additions & 0 deletionscoderd/database/dbmem/dbmem.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4848,6 +4848,13 @@ func (q *FakeQuerier) GetProvisionerJobsByOrganizationAndStatusWithQueuePosition
row.AvailableWorkers = append(row.AvailableWorkers, worker.ID)
}
}

// Add daemon name to provisioner job
for _, daemon := range q.provisionerDaemons {
if job.WorkerID.Valid && job.WorkerID.UUID == daemon.ID {
row.WorkerName = daemon.Name
}
}
rows = append(rows, row)
}

Expand Down
12 changes: 10 additions & 2 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.

10 changes: 8 additions & 2 deletionscoderd/database/queries/provisionerjobs.sql
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -160,7 +160,9 @@ SELECT
COALESCE(t.display_name, '') AS template_display_name,
COALESCE(t.icon, '') AS template_icon,
w.id AS workspace_id,
COALESCE(w.name, '') AS workspace_name
COALESCE(w.name, '') AS workspace_name,
-- Include the name of the provisioner_daemon associated to the job
COALESCE(pd.name, '') AS worker_name
FROM
provisioner_jobs pj
LEFT JOIN
Expand All@@ -185,6 +187,9 @@ LEFT JOIN
t.id = tv.template_id
AND t.organization_id = pj.organization_id
)
LEFT JOIN
-- Join to get the daemon name corresponding to the job's worker_id
provisioner_daemons pd ON pd.id = pj.worker_id
WHERE
pj.organization_id = @organization_id::uuid
AND (COALESCE(array_length(@ids::uuid[], 1), 0) = 0 OR pj.id = ANY(@ids::uuid[]))
Expand All@@ -200,7 +205,8 @@ GROUP BY
t.display_name,
t.icon,
w.id,
w.name
w.name,
pd.name
ORDER BY
pj.created_at DESC
LIMIT
Expand Down
1 change: 1 addition & 0 deletionscoderd/provisionerjobs.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -395,6 +395,7 @@ func convertProvisionerJobWithQueuePosition(pj database.GetProvisionerJobsByOrga
QueuePosition: pj.QueuePosition,
QueueSize: pj.QueueSize,
})
job.WorkerName = pj.WorkerName
job.AvailableWorkers = pj.AvailableWorkers
job.Metadata = codersdk.ProvisionerJobMetadata{
TemplateVersionName: pj.TemplateVersionName,
Expand Down
Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp