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:
+15
-1
@@ -145,9 +145,11 @@ func parseParameterMapFile(parameterFile string) (map[string]string, error) {
|
||||
return parameterMap, nil
|
||||
}
|
||||
|
||||
// buildFlags contains options relating to troubleshooting provisioner jobs.
|
||||
// buildFlags contains options relating to troubleshooting provisioner jobs
|
||||
// and setting the reason for the workspace build.
|
||||
type buildFlags struct {
|
||||
provisionerLogDebug bool
|
||||
reason string
|
||||
}
|
||||
|
||||
func (bf *buildFlags) cliOptions() []serpent.Option {
|
||||
@@ -160,5 +162,17 @@ This is useful for troubleshooting build issues.`,
|
||||
Value: serpent.BoolOf(&bf.provisionerLogDebug),
|
||||
Hidden: true,
|
||||
},
|
||||
{
|
||||
Flag: "reason",
|
||||
Description: `Sets the reason for the workspace build (cli, vscode_connection, jetbrains_connection).`,
|
||||
Value: serpent.EnumOf(
|
||||
&bf.reason,
|
||||
string(codersdk.BuildReasonCLI),
|
||||
string(codersdk.BuildReasonVSCodeConnection),
|
||||
string(codersdk.BuildReasonJetbrainsConnection),
|
||||
),
|
||||
Default: string(codersdk.BuildReasonCLI),
|
||||
Hidden: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user