mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
feat: add template builder deployment config and telemetry types (#25082)
This commit is contained in:
+9
@@ -847,6 +847,15 @@ when required by your organization's security policy.
|
||||
Whether telemetry is enabled or not. Coder collects anonymized usage
|
||||
data to help improve our product.
|
||||
|
||||
TEMPLATE BUILDER OPTIONS:
|
||||
--disable-template-builder bool, $CODER_DISABLE_TEMPLATE_BUILDER
|
||||
Disable the template builder feature for guided template creation.
|
||||
When disabled, all /api/v2/templatebuilder/* endpoints return 404.
|
||||
|
||||
--template-builder-registry-url string, $CODER_TEMPLATE_BUILDER_REGISTRY_URL (default: https://registry.coder.com)
|
||||
The base URL of the module registry used by the template builder for
|
||||
module source paths.
|
||||
|
||||
USER QUIET HOURS SCHEDULE OPTIONS:
|
||||
Allow users to set quiet hours schedules each day for workspaces to avoid
|
||||
workspaces stopping during the day due to template scheduling.
|
||||
|
||||
+9
@@ -911,3 +911,12 @@ retention:
|
||||
# build are always retained. Set to 0 to disable automatic deletion.
|
||||
# (default: 7d, type: duration)
|
||||
workspace_agent_logs: 168h0m0s
|
||||
templateBuilder:
|
||||
# Disable the template builder feature for guided template creation. When
|
||||
# disabled, all /api/v2/templatebuilder/* endpoints return 404.
|
||||
# (default: <unset>, type: bool)
|
||||
disabled: false
|
||||
# The base URL of the module registry used by the template builder for module
|
||||
# source paths.
|
||||
# (default: https://registry.coder.com, type: string)
|
||||
registryURL: https://registry.coder.com
|
||||
|
||||
Generated
+14
@@ -17820,6 +17820,9 @@ const docTemplate = `{
|
||||
"telemetry": {
|
||||
"$ref": "#/definitions/codersdk.TelemetryConfig"
|
||||
},
|
||||
"template_builder": {
|
||||
"$ref": "#/definitions/codersdk.TemplateBuilderConfig"
|
||||
},
|
||||
"terms_of_service_url": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -22480,6 +22483,17 @@ const docTemplate = `{
|
||||
"$ref": "#/definitions/codersdk.TransitionStats"
|
||||
}
|
||||
},
|
||||
"codersdk.TemplateBuilderConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"disabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"registry_url": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"codersdk.TemplateExample": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
Generated
+14
@@ -16179,6 +16179,9 @@
|
||||
"telemetry": {
|
||||
"$ref": "#/definitions/codersdk.TelemetryConfig"
|
||||
},
|
||||
"template_builder": {
|
||||
"$ref": "#/definitions/codersdk.TemplateBuilderConfig"
|
||||
},
|
||||
"terms_of_service_url": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -20668,6 +20671,17 @@
|
||||
"$ref": "#/definitions/codersdk.TransitionStats"
|
||||
}
|
||||
},
|
||||
"codersdk.TemplateBuilderConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"disabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"registry_url": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"codersdk.TemplateExample": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -1541,6 +1541,16 @@ func New(options *Options) *API {
|
||||
})
|
||||
})
|
||||
})
|
||||
if !api.DeploymentValues.TemplateBuilder.Disabled.Value() {
|
||||
r.Route("/templatebuilder", func(r chi.Router) {
|
||||
r.Use(
|
||||
apiKeyMiddleware,
|
||||
)
|
||||
// Endpoints added by DEVEX-275 (bases), DEVEX-276
|
||||
// (modules), DEVEX-277/279 (compose).
|
||||
})
|
||||
}
|
||||
|
||||
r.Route("/users", func(r chi.Router) {
|
||||
r.Get("/first", api.firstUser)
|
||||
r.Post("/first", api.postFirstUser)
|
||||
|
||||
@@ -1610,6 +1610,7 @@ type Snapshot struct {
|
||||
ChatModelConfigs []ChatModelConfig `json:"chat_model_configs"`
|
||||
ChatDiffStatusSummary *ChatDiffStatusSummary `json:"chat_diff_status_summary"`
|
||||
UserSecretsSummary *UserSecretsSummary `json:"user_secrets_summary"`
|
||||
TemplateBuilderSessions []TemplateBuilderSession `json:"template_builder_sessions"`
|
||||
}
|
||||
|
||||
// Deployment contains information about the host running Coder.
|
||||
@@ -2497,6 +2498,21 @@ type UserSecretsSummary struct {
|
||||
SecretsPerUserP90 int64 `json:"secrets_per_user_p90"`
|
||||
}
|
||||
|
||||
// TemplateBuilderSession tracks a single event in the template builder
|
||||
// wizard. Two events are emitted per session: one on wizard entry and
|
||||
// one on compose completion. User-supplied variable values are never
|
||||
// included.
|
||||
type TemplateBuilderSession struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
EventType string `json:"event_type"`
|
||||
UserID uuid.UUID `json:"user_id"`
|
||||
BaseTemplateID string `json:"base_template_id,omitempty"`
|
||||
ModuleIDs []string `json:"module_ids,omitempty"`
|
||||
DurationSeconds float64 `json:"duration_seconds,omitempty"`
|
||||
Success bool `json:"success,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
func ConvertAIBridgeInterceptionsSummary(endTime time.Time, provider, model, client string, summary database.CalculateAIBridgeInterceptionsTelemetrySummaryRow) AIBridgeInterceptionsSummary {
|
||||
return AIBridgeInterceptionsSummary{
|
||||
ID: uuid.New(),
|
||||
|
||||
@@ -645,6 +645,7 @@ type DeploymentValues struct {
|
||||
HideAITasks serpent.Bool `json:"hide_ai_tasks,omitempty" typescript:",notnull"`
|
||||
AI AIConfig `json:"ai,omitempty"`
|
||||
StatsCollection StatsCollectionConfig `json:"stats_collection,omitempty" typescript:",notnull"`
|
||||
TemplateBuilder TemplateBuilderConfig `json:"template_builder,omitempty"`
|
||||
|
||||
Config serpent.YAMLConfigPath `json:"config,omitempty" typescript:",notnull"`
|
||||
WriteConfig serpent.Bool `json:"write_config,omitempty" typescript:",notnull"`
|
||||
@@ -1462,6 +1463,10 @@ func (c *DeploymentValues) Options() serpent.OptionSet {
|
||||
Description: "Configure data retention policies for various database tables. Retention policies automatically purge old data to reduce database size and improve performance. Setting a retention duration to 0 disables automatic purging for that data type.",
|
||||
YAML: "retention",
|
||||
}
|
||||
deploymentGroupTemplateBuilder = serpent.Group{
|
||||
Name: "Template Builder",
|
||||
YAML: "templateBuilder",
|
||||
}
|
||||
)
|
||||
|
||||
httpAddress := serpent.Option{
|
||||
@@ -4059,6 +4064,25 @@ Write out the current server config as YAML to stdout.`,
|
||||
// used externally.
|
||||
Hidden: true,
|
||||
},
|
||||
{
|
||||
Name: "Disable Template Builder",
|
||||
Description: "Disable the template builder feature for guided template creation. When disabled, all /api/v2/templatebuilder/* endpoints return 404.",
|
||||
Flag: "disable-template-builder",
|
||||
Env: "CODER_DISABLE_TEMPLATE_BUILDER",
|
||||
Value: &c.TemplateBuilder.Disabled,
|
||||
Group: &deploymentGroupTemplateBuilder,
|
||||
YAML: "disabled",
|
||||
},
|
||||
{
|
||||
Name: "Template Builder Registry URL",
|
||||
Description: "The base URL of the module registry used by the template builder for module source paths.",
|
||||
Flag: "template-builder-registry-url",
|
||||
Env: "CODER_TEMPLATE_BUILDER_REGISTRY_URL",
|
||||
Value: &c.TemplateBuilder.RegistryURL,
|
||||
Default: "https://registry.coder.com",
|
||||
Group: &deploymentGroupTemplateBuilder,
|
||||
YAML: "registryURL",
|
||||
},
|
||||
}
|
||||
|
||||
return opts
|
||||
@@ -4168,6 +4192,11 @@ type AIConfig struct {
|
||||
Chat ChatConfig `json:"chat,omitempty" typescript:",notnull"`
|
||||
}
|
||||
|
||||
type TemplateBuilderConfig struct {
|
||||
Disabled serpent.Bool `json:"disabled,omitempty"`
|
||||
RegistryURL serpent.String `json:"registry_url,omitempty"`
|
||||
}
|
||||
|
||||
type SupportConfig struct {
|
||||
Links serpent.Struct[[]LinkConfig] `json:"links" typescript:",notnull"`
|
||||
}
|
||||
|
||||
Generated
+4
@@ -585,6 +585,10 @@ curl -X GET http://coder-server:8080/api/v2/deployment/config \
|
||||
"user": {}
|
||||
}
|
||||
},
|
||||
"template_builder": {
|
||||
"disabled": true,
|
||||
"registry_url": "string"
|
||||
},
|
||||
"terms_of_service_url": "string",
|
||||
"tls": {
|
||||
"address": {
|
||||
|
||||
Generated
+25
@@ -5651,6 +5651,10 @@ CreateWorkspaceRequest provides options for creating a new workspace. Only one o
|
||||
"user": {}
|
||||
}
|
||||
},
|
||||
"template_builder": {
|
||||
"disabled": true,
|
||||
"registry_url": "string"
|
||||
},
|
||||
"terms_of_service_url": "string",
|
||||
"tls": {
|
||||
"address": {
|
||||
@@ -6243,6 +6247,10 @@ CreateWorkspaceRequest provides options for creating a new workspace. Only one o
|
||||
"user": {}
|
||||
}
|
||||
},
|
||||
"template_builder": {
|
||||
"disabled": true,
|
||||
"registry_url": "string"
|
||||
},
|
||||
"terms_of_service_url": "string",
|
||||
"tls": {
|
||||
"address": {
|
||||
@@ -6356,6 +6364,7 @@ CreateWorkspaceRequest provides options for creating a new workspace. Only one o
|
||||
| `support` | [codersdk.SupportConfig](#codersdksupportconfig) | false | | |
|
||||
| `swagger` | [codersdk.SwaggerConfig](#codersdkswaggerconfig) | false | | |
|
||||
| `telemetry` | [codersdk.TelemetryConfig](#codersdktelemetryconfig) | false | | |
|
||||
| `template_builder` | [codersdk.TemplateBuilderConfig](#codersdktemplatebuilderconfig) | false | | |
|
||||
| `terms_of_service_url` | string | false | | |
|
||||
| `tls` | [codersdk.TLSConfig](#codersdktlsconfig) | false | | |
|
||||
| `trace` | [codersdk.TraceConfig](#codersdktraceconfig) | false | | |
|
||||
@@ -11820,6 +11829,22 @@ Restarts will only happen on weekdays in this list on weeks which line up with W
|
||||
|------------------|------------------------------------------------------|----------|--------------|-------------|
|
||||
| `[any property]` | [codersdk.TransitionStats](#codersdktransitionstats) | false | | |
|
||||
|
||||
## codersdk.TemplateBuilderConfig
|
||||
|
||||
```json
|
||||
{
|
||||
"disabled": true,
|
||||
"registry_url": "string"
|
||||
}
|
||||
```
|
||||
|
||||
### Properties
|
||||
|
||||
| Name | Type | Required | Restrictions | Description |
|
||||
|----------------|---------|----------|--------------|-------------|
|
||||
| `disabled` | boolean | false | | |
|
||||
| `registry_url` | string | false | | |
|
||||
|
||||
## codersdk.TemplateExample
|
||||
|
||||
```json
|
||||
|
||||
Generated
+21
@@ -2046,3 +2046,24 @@ How long expired API keys are retained before being deleted. Keeping expired key
|
||||
| Default | <code>7d</code> |
|
||||
|
||||
How long workspace agent logs are retained. Logs from non-latest builds are deleted if the agent hasn't connected within this period. Logs from the latest build are always retained. Set to 0 to disable automatic deletion.
|
||||
|
||||
### --disable-template-builder
|
||||
|
||||
| | |
|
||||
|-------------|----------------------------------------------|
|
||||
| Type | <code>bool</code> |
|
||||
| Environment | <code>$CODER_DISABLE_TEMPLATE_BUILDER</code> |
|
||||
| YAML | <code>templateBuilder.disabled</code> |
|
||||
|
||||
Disable the template builder feature for guided template creation. When disabled, all /api/v2/templatebuilder/* endpoints return 404.
|
||||
|
||||
### --template-builder-registry-url
|
||||
|
||||
| | |
|
||||
|-------------|---------------------------------------------------|
|
||||
| Type | <code>string</code> |
|
||||
| Environment | <code>$CODER_TEMPLATE_BUILDER_REGISTRY_URL</code> |
|
||||
| YAML | <code>templateBuilder.registryURL</code> |
|
||||
| Default | <code>https://registry.coder.com</code> |
|
||||
|
||||
The base URL of the module registry used by the template builder for module source paths.
|
||||
|
||||
@@ -848,6 +848,15 @@ when required by your organization's security policy.
|
||||
Whether telemetry is enabled or not. Coder collects anonymized usage
|
||||
data to help improve our product.
|
||||
|
||||
TEMPLATE BUILDER OPTIONS:
|
||||
--disable-template-builder bool, $CODER_DISABLE_TEMPLATE_BUILDER
|
||||
Disable the template builder feature for guided template creation.
|
||||
When disabled, all /api/v2/templatebuilder/* endpoints return 404.
|
||||
|
||||
--template-builder-registry-url string, $CODER_TEMPLATE_BUILDER_REGISTRY_URL (default: https://registry.coder.com)
|
||||
The base URL of the module registry used by the template builder for
|
||||
module source paths.
|
||||
|
||||
USER QUIET HOURS SCHEDULE OPTIONS:
|
||||
Allow users to set quiet hours schedules each day for workspaces to avoid
|
||||
workspaces stopping during the day due to template scheduling.
|
||||
|
||||
Generated
+7
@@ -3761,6 +3761,7 @@ export interface DeploymentValues {
|
||||
readonly hide_ai_tasks?: boolean;
|
||||
readonly ai?: AIConfig;
|
||||
readonly stats_collection?: StatsCollectionConfig;
|
||||
readonly template_builder?: TemplateBuilderConfig;
|
||||
readonly config?: string;
|
||||
readonly write_config?: boolean;
|
||||
/**
|
||||
@@ -7593,6 +7594,12 @@ export type TemplateBuildTimeStats = Record<
|
||||
TransitionStats
|
||||
>;
|
||||
|
||||
// From codersdk/deployment.go
|
||||
export interface TemplateBuilderConfig {
|
||||
readonly disabled?: boolean;
|
||||
readonly registry_url?: string;
|
||||
}
|
||||
|
||||
// From codersdk/insights.go
|
||||
/**
|
||||
* Enums define the display name of the builtin app reported.
|
||||
|
||||
Reference in New Issue
Block a user