mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: extend workspace build reasons to track connection types (#18827)
This PR introduces new build reason values to identify what type of connection triggered a workspace build, helping to troubleshoot workspace-related issues. ## Database Migration Added migration 000349_extend_workspace_build_reason.up.sql that extends the build_reason enum with new values: ``` dashboard, cli, ssh_connection, vscode_connection, jetbrains_connection ``` ## Implementation The build reason is specified through the API when creating new workspace builds: - Dashboard: Automatically sets reason to `dashboard` when users start workspaces via the web interface - CLI `start` command: Sets reason to `cli` when workspaces are started via the command line - CLI `ssh` command: Sets reason to ssh_connection when workspaces are started due to SSH connections - VS Code connections: Will be set to `vscode_connection` by the VS Code extension through CLI hidden flag (https://github.com/coder/vscode-coder/pull/550) - JetBrains connections: Will be set to `jetbrains_connection` by the Jetbrains Toolbox (https://github.com/coder/coder-jetbrains-toolbox/pull/150) and Jetbrains Gateway extension (https://github.com/coder/jetbrains-coder/pull/561) ## UI Changes: * Tooltip with reason in Build history <img width="309" height="457" alt="image" src="https://github.com/user-attachments/assets/bde8440b-bf3b-49a1-a244-ed7e8eb9763c" /> * Reason in Audit Logs Row tooltip <img width="906" height="237" alt="image" src="https://github.com/user-attachments/assets/ebbb62c7-cf07-4398-afbf-323c83fb6426" /> <img width="909" height="188" alt="image" src="https://github.com/user-attachments/assets/1ddbab07-44bf-4dee-8867-b4e2cd56ae96" />
This commit is contained in:
Generated
+1
@@ -1762,6 +1762,7 @@ curl -X POST http://coder-server:8080/api/v2/workspaces/{workspace}/builds \
|
||||
"dry_run": true,
|
||||
"log_level": "debug",
|
||||
"orphan": true,
|
||||
"reason": "dashboard",
|
||||
"rich_parameter_values": [
|
||||
{
|
||||
"name": "string",
|
||||
|
||||
Generated
+42
-12
@@ -1044,12 +1044,17 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
|
||||
|
||||
#### Enumerated Values
|
||||
|
||||
| Value |
|
||||
|-------------|
|
||||
| `initiator` |
|
||||
| `autostart` |
|
||||
| `autostop` |
|
||||
| `dormancy` |
|
||||
| Value |
|
||||
|------------------------|
|
||||
| `initiator` |
|
||||
| `autostart` |
|
||||
| `autostop` |
|
||||
| `dormancy` |
|
||||
| `dashboard` |
|
||||
| `cli` |
|
||||
| `ssh_connection` |
|
||||
| `vscode_connection` |
|
||||
| `jetbrains_connection` |
|
||||
|
||||
## codersdk.ChangePasswordWithOneTimePasscodeRequest
|
||||
|
||||
@@ -1689,6 +1694,24 @@ This is required on creation to enable a user-flow of validating a template work
|
||||
| `user_status` | [codersdk.UserStatus](#codersdkuserstatus) | false | | User status defaults to UserStatusDormant. |
|
||||
| `username` | string | true | | |
|
||||
|
||||
## codersdk.CreateWorkspaceBuildReason
|
||||
|
||||
```json
|
||||
"dashboard"
|
||||
```
|
||||
|
||||
### Properties
|
||||
|
||||
#### Enumerated Values
|
||||
|
||||
| Value |
|
||||
|------------------------|
|
||||
| `dashboard` |
|
||||
| `cli` |
|
||||
| `ssh_connection` |
|
||||
| `vscode_connection` |
|
||||
| `jetbrains_connection` |
|
||||
|
||||
## codersdk.CreateWorkspaceBuildRequest
|
||||
|
||||
```json
|
||||
@@ -1696,6 +1719,7 @@ This is required on creation to enable a user-flow of validating a template work
|
||||
"dry_run": true,
|
||||
"log_level": "debug",
|
||||
"orphan": true,
|
||||
"reason": "dashboard",
|
||||
"rich_parameter_values": [
|
||||
{
|
||||
"name": "string",
|
||||
@@ -1718,6 +1742,7 @@ This is required on creation to enable a user-flow of validating a template work
|
||||
| `dry_run` | boolean | false | | |
|
||||
| `log_level` | [codersdk.ProvisionerLogLevel](#codersdkprovisionerloglevel) | false | | Log level changes the default logging verbosity of a provider ("info" if empty). |
|
||||
| `orphan` | boolean | false | | Orphan may be set for the Destroy transition. |
|
||||
| `reason` | [codersdk.CreateWorkspaceBuildReason](#codersdkcreateworkspacebuildreason) | false | | Reason sets the reason for the workspace build. |
|
||||
| `rich_parameter_values` | array of [codersdk.WorkspaceBuildParameter](#codersdkworkspacebuildparameter) | false | | Rich parameter values are optional. It will write params to the 'workspace' scope. This will overwrite any existing parameters with the same name. This will not delete old params not included in this list. |
|
||||
| `state` | array of integer | false | | |
|
||||
| `template_version_id` | string | false | | |
|
||||
@@ -1726,12 +1751,17 @@ This is required on creation to enable a user-flow of validating a template work
|
||||
|
||||
#### Enumerated Values
|
||||
|
||||
| Property | Value |
|
||||
|--------------|----------|
|
||||
| `log_level` | `debug` |
|
||||
| `transition` | `start` |
|
||||
| `transition` | `stop` |
|
||||
| `transition` | `delete` |
|
||||
| Property | Value |
|
||||
|--------------|------------------------|
|
||||
| `log_level` | `debug` |
|
||||
| `reason` | `dashboard` |
|
||||
| `reason` | `cli` |
|
||||
| `reason` | `ssh_connection` |
|
||||
| `reason` | `vscode_connection` |
|
||||
| `reason` | `jetbrains_connection` |
|
||||
| `transition` | `start` |
|
||||
| `transition` | `stop` |
|
||||
| `transition` | `delete` |
|
||||
|
||||
## codersdk.CreateWorkspaceProxyRequest
|
||||
|
||||
|
||||
Reference in New Issue
Block a user