mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add template setting to require active template version (#10277)
This commit is contained in:
@@ -50,6 +50,7 @@ const (
|
||||
FeatureExternalTokenEncryption FeatureName = "external_token_encryption"
|
||||
FeatureTemplateAutostopRequirement FeatureName = "template_autostop_requirement"
|
||||
FeatureWorkspaceBatchActions FeatureName = "workspace_batch_actions"
|
||||
FeatureAccessControl FeatureName = "access_control"
|
||||
)
|
||||
|
||||
// FeatureNames must be kept in-sync with the Feature enum above.
|
||||
@@ -70,6 +71,7 @@ var FeatureNames = []FeatureName{
|
||||
FeatureExternalTokenEncryption,
|
||||
FeatureTemplateAutostopRequirement,
|
||||
FeatureWorkspaceBatchActions,
|
||||
FeatureAccessControl,
|
||||
}
|
||||
|
||||
// Humanize returns the feature name in a human-readable format.
|
||||
|
||||
@@ -124,6 +124,10 @@ type CreateTemplateRequest struct {
|
||||
// and must be explicitly granted to users or groups in the permissions settings
|
||||
// of the template.
|
||||
DisableEveryoneGroupAccess bool `json:"disable_everyone_group_access"`
|
||||
|
||||
// RequireActiveVersion mandates that workspaces are built with the active
|
||||
// template version.
|
||||
RequireActiveVersion bool `json:"require_active_version"`
|
||||
}
|
||||
|
||||
// CreateWorkspaceRequest provides options for creating a new workspace.
|
||||
|
||||
@@ -52,6 +52,10 @@ type Template struct {
|
||||
FailureTTLMillis int64 `json:"failure_ttl_ms"`
|
||||
TimeTilDormantMillis int64 `json:"time_til_dormant_ms"`
|
||||
TimeTilDormantAutoDeleteMillis int64 `json:"time_til_dormant_autodelete_ms"`
|
||||
|
||||
// RequireActiveVersion mandates that workspaces are built with the active
|
||||
// template version.
|
||||
RequireActiveVersion bool `json:"require_active_version"`
|
||||
}
|
||||
|
||||
// WeekdaysToBitmap converts a list of weekdays to a bitmap in accordance with
|
||||
@@ -221,6 +225,10 @@ type UpdateTemplateMeta struct {
|
||||
// from the template. This is useful for preventing dormant workspaces being immediately
|
||||
// deleted when updating the dormant_ttl field to a new, shorter value.
|
||||
UpdateWorkspaceDormantAt bool `json:"update_workspace_dormant_at"`
|
||||
// RequireActiveVersion mandates workspaces built using this template
|
||||
// use the active version of the template. This option has no
|
||||
// effect on template admins.
|
||||
RequireActiveVersion bool `json:"require_active_version"`
|
||||
}
|
||||
|
||||
type TemplateExample struct {
|
||||
|
||||
Reference in New Issue
Block a user