feat(cli): add provisioner list and provisioner jobs list (#16030)

This commit is contained in:
Mathias Fredriksson
2025-01-20 17:24:22 +00:00
committed by GitHub
parent 91204c2e3c
commit c0db364f3f
34 changed files with 881 additions and 30 deletions
+6
View File
@@ -0,0 +1,6 @@
ID CREATED AT STATUS WORKER ID TAGS TEMPLATE VERSION ID WORKSPACE BUILD ID TYPE AVAILABLE WORKERS ORGANIZATION QUEUE
00000000-0000-0000-bbbb-000000000000 ====[timestamp]===== succeeded 00000000-0000-0000-aaaa-000000000000 map[owner: scope:organization] 00000000-0000-0000-cccc-000000000000 <nil> template_version_import [] Coder
00000000-0000-0000-bbbb-000000000001 ====[timestamp]===== succeeded 00000000-0000-0000-aaaa-000000000000 map[owner: scope:organization] <nil> 00000000-0000-0000-dddd-000000000000 workspace_build [] Coder
00000000-0000-0000-bbbb-000000000002 ====[timestamp]===== running 00000000-0000-0000-aaaa-000000000001 map[00000000-0000-0000-bbbb-000000000002:true foo:bar owner: scope:organization] <nil> 00000000-0000-0000-dddd-000000000001 workspace_build [] Coder
00000000-0000-0000-bbbb-000000000003 ====[timestamp]===== succeeded 00000000-0000-0000-aaaa-000000000002 map[00000000-0000-0000-bbbb-000000000003:true owner: scope:organization] <nil> 00000000-0000-0000-dddd-000000000002 workspace_build [] Coder
00000000-0000-0000-bbbb-000000000004 ====[timestamp]===== pending <nil> map[owner: scope:organization] <nil> 00000000-0000-0000-dddd-000000000003 workspace_build [00000000-0000-0000-aaaa-000000000000, 00000000-0000-0000-aaaa-000000000002, 00000000-0000-0000-aaaa-000000000003] Coder 1/1
+5
View File
@@ -0,0 +1,5 @@
ID CREATED AT LAST SEEN AT NAME VERSION TAGS KEY NAME STATUS CURRENT JOB ID CURRENT JOB STATUS PREVIOUS JOB ID PREVIOUS JOB STATUS ORGANIZATION
00000000-0000-0000-aaaa-000000000001 ====[timestamp]===== ====[timestamp]===== provisioner-1 v0.0.0 map[foo:bar owner: scope:organization] built-in busy 00000000-0000-0000-bbbb-000000000002 running <nil> <nil> Coder
00000000-0000-0000-aaaa-000000000002 ====[timestamp]===== ====[timestamp]===== provisioner-2 v0.0.0 map[owner: scope:organization] built-in offline <nil> <nil> 00000000-0000-0000-bbbb-000000000003 succeeded Coder
00000000-0000-0000-aaaa-000000000003 ====[timestamp]===== ====[timestamp]===== provisioner-3 v0.0.0 map[owner: scope:organization] built-in idle <nil> <nil> <nil> <nil> Coder
00000000-0000-0000-aaaa-000000000000 ====[timestamp]===== ====[timestamp]===== test v0.0.0-devel map[owner: scope:organization] built-in idle <nil> <nil> 00000000-0000-0000-bbbb-000000000001 succeeded Coder
+1
View File
@@ -35,6 +35,7 @@ SUBCOMMANDS:
ping Ping a workspace
port-forward Forward ports from a workspace to the local machine. For
reverse port forwarding, use "coder ssh -R".
provisioner View and manage provisioner daemons and jobs
publickey Output your Coder public key used for Git operations
rename Rename a workspace
reset-password Directly connect to the database to reset a user's
+15
View File
@@ -0,0 +1,15 @@
coder v0.0.0-devel
USAGE:
coder provisioner
View and manage provisioner daemons and jobs
Aliases: provisioners
SUBCOMMANDS:
jobs View and manage provisioner jobs
list List provisioner daemons in an organization
———
Run `coder --help` for a list of global options.
+14
View File
@@ -0,0 +1,14 @@
coder v0.0.0-devel
USAGE:
coder provisioner jobs
View and manage provisioner jobs
Aliases: job
SUBCOMMANDS:
list List provisioner jobs
———
Run `coder --help` for a list of global options.
+3
View File
@@ -0,0 +1,3 @@
ID CREATED AT STATUS TAGS TYPE ORGANIZATION QUEUE
==========[version job ID]========== ====[timestamp]===== succeeded map[owner: scope:organization] template_version_import Coder
======[workspace build job ID]====== ====[timestamp]===== succeeded map[owner: scope:organization] workspace_build Coder
+27
View File
@@ -0,0 +1,27 @@
coder v0.0.0-devel
USAGE:
coder provisioner jobs list [flags]
List provisioner jobs
Aliases: ls
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|organization|queue] (default: created at,id,organization,status,type,queue,tags)
Columns to display in table output.
-l, --limit int, $CODER_PROVISIONER_JOB_LIST_LIMIT (default: 50)
Limit the number of jobs returned.
-o, --output table|json (default: table)
Output format.
-s, --status [pending|running|succeeded|canceling|canceled|failed|unknown], $CODER_PROVISIONER_JOB_LIST_STATUS
Filter by job status.
———
Run `coder --help` for a list of global options.
@@ -0,0 +1,44 @@
[
{
"id": "==========[version job ID]==========",
"created_at": "====[timestamp]=====",
"started_at": "====[timestamp]=====",
"completed_at": "====[timestamp]=====",
"status": "succeeded",
"worker_id": "====[workspace build worker ID]=====",
"file_id": "=====[workspace build file ID]======",
"tags": {
"owner": "",
"scope": "organization"
},
"queue_position": 0,
"queue_size": 0,
"organization_id": "===========[first org ID]===========",
"input": {
"template_version_id": "============[version ID]============"
},
"type": "template_version_import",
"organization_name": "Coder"
},
{
"id": "======[workspace build job ID]======",
"created_at": "====[timestamp]=====",
"started_at": "====[timestamp]=====",
"completed_at": "====[timestamp]=====",
"status": "succeeded",
"worker_id": "====[workspace build worker ID]=====",
"file_id": "=====[workspace build file ID]======",
"tags": {
"owner": "",
"scope": "organization"
},
"queue_position": 0,
"queue_size": 0,
"organization_id": "===========[first org ID]===========",
"input": {
"workspace_build_id": "========[workspace build ID]========"
},
"type": "workspace_build",
"organization_name": "Coder"
}
]
+2
View File
@@ -0,0 +1,2 @@
CREATED AT LAST SEEN AT NAME VERSION TAGS KEY NAME STATUS ORGANIZATION
====[timestamp]===== ====[timestamp]===== test v0.0.0-devel map[owner: scope:organization] built-in idle Coder
+21
View File
@@ -0,0 +1,21 @@
coder v0.0.0-devel
USAGE:
coder provisioner list [flags]
List provisioner daemons in an organization
Aliases: ls
OPTIONS:
-O, --org string, $CODER_ORGANIZATION
Select which organization (uuid or name) to use.
-c, --column [id|organization id|created at|last seen at|name|version|api version|tags|key name|status|current job id|current job status|previous job id|previous job status|organization] (default: name,organization,status,key name,created at,last seen at,version,tags)
Columns to display in table output.
-o, --output table|json (default: table)
Output format.
———
Run `coder --help` for a list of global options.
@@ -0,0 +1,27 @@
[
{
"id": "====[workspace build worker ID]=====",
"organization_id": "===========[first org ID]===========",
"key_id": "00000000-0000-0000-0000-000000000001",
"created_at": "====[timestamp]=====",
"last_seen_at": "====[timestamp]=====",
"name": "test",
"version": "v0.0.0-devel",
"api_version": "1.2",
"provisioners": [
"echo"
],
"tags": {
"owner": "",
"scope": "organization"
},
"key_name": "built-in",
"status": "idle",
"current_job": null,
"previous_job": {
"id": "======[workspace build job ID]======",
"status": "succeeded"
},
"organization_name": "Coder"
}
]