mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add provisioner daemon name to provisioner jobs responses (#17877)
# Description This PR adds the `worker_name` field to the provisioner jobs endpoint. To achieve this, the following SQL query was updated: - `GetProvisionerJobsByOrganizationAndStatusWithQueuePositionAndProvisioner` As a result, the `codersdk.ProvisionerJob` type, which represents the provisioner job API response, was modified to include the new field. **Notes:** * As mentioned in [comment](https://github.com/coder/coder/pull/17877#discussion_r2093218206), the `GetProvisionerJobsByIDsWithQueuePosition` query was not changed due to load concerns. This means that for template and template version endpoints, `worker_id` will still be returned, but `worker_name` will not. * Similar to `worker_id`, the `worker_name` is only present once a job is assigned to a provisioner daemon. For jobs in a pending state (not yet assigned), neither `worker_id` nor `worker_name` will be returned. --- # Affected Endpoints - `/organizations/{organization}/provisionerjobs` - `/organizations/{organization}/provisionerjobs/{job}` --- # Testing - Added new tests verifying that both `worker_id` and `worker_name` are returned once a provisioner job reaches the **succeeded** state. - Existing tests covering state transitions and other logic remain unchanged, as they test different scenarios. --- # Front-end Changes Admin provisioner jobs dashboard: <img width="1088" alt="Screenshot 2025-05-16 at 11 51 33" src="https://github.com/user-attachments/assets/0e20e360-c615-4497-84b7-693777c5443e" /> Fixes: https://github.com/coder/coder/issues/16982
This commit is contained in:
+1
-1
@@ -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)
|
||||
|
||||
@@ -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": "",
|
||||
@@ -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": "",
|
||||
|
||||
+2
-2
@@ -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 NAME VERSION STATUS TAGS
|
||||
====[timestamp]===== ====[timestamp]===== built-in test-daemon v0.0.0-devel idle map[owner: scope:organization]
|
||||
|
||||
@@ -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": [
|
||||
|
||||
Reference in New Issue
Block a user