-
Notifications
You must be signed in to change notification settings - Fork 948
feat: extend workspace build reasons to track connection types #18827
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
ALTER TYPE build_reason ADD VALUE IF NOT EXISTS 'ssh_connection'; | ||
ALTER TYPE build_reason ADD VALUE IF NOT EXISTS 'vscode_connection'; | ||
ALTER TYPE build_reason ADD VALUE IF NOT EXISTS 'jetbrains_connection'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The _connection
part is implicit here - if you're using any of these, it was to connect to the workspace. I would personally drop the suffixes, but it's up to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FE code looks good 👍, only left a minor comment
site/src/utils/workspace.tsx
Outdated
@@ -87,6 +92,26 @@ export const getDisplayWorkspaceBuildInitiatedBy = ( | |||
return undefined; | |||
}; | |||
|
|||
export const getDisplayInitiatorBuildReason = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I think this is a nice case to use records.
const buildReasonLabels: Record<BuildReason, string> = {
initiator: "API",
dashboard: "Dashboard",
cli: "CLI",
// ...
}
So you can use it directly in the component:
<span>{buildReasonLabels[log.build_reason]}</span>
Wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BrunoQuaresma I’ve slightly modified the impl based on your suggestion. PTAL
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:
Implementation
The build reason is specified through the API when creating new workspace builds:
dashboard
when users start workspaces via the web interfacestart
command: Sets reason tocli
when workspaces are started via the command linessh
command: Sets reason to ssh_connection when workspaces are started due to SSH connectionsvscode_connection
by the VS Code extension through CLI hidden flag (feat: set 'vscode_connection' as build reason on workspace start vscode-coder#550)jetbrains_connection
by the Jetbrains Toolbox (feat: set 'jetbrains_connection' as build reason on workspace start coder-jetbrains-toolbox#150) and Jetbrains Gateway extension (feat: set 'jetbrains_connection' as build reason on workspace start jetbrains-coder#561)UI Changes: