Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 72b6c42

Browse files
committed
Enable prebuilds
Signed-off-by: Danny Kopping <[email protected]> # Conflicts: # codersdk/deployment.go
1 parent ff8d3de commit 72b6c42

File tree

11 files changed

+210
-1
lines changed

11 files changed

+210
-1
lines changed

cli/testdata/coder_server_--help.golden

+6
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,12 @@ workspaces stopping during the day due to template scheduling.
670670
must be *. Only one hour and minute can be specified (ranges or comma
671671
separated values are not supported).
672672

673+
WORKSPACE PREBUILDS OPTIONS:
674+
Configure how workspace prebuilds behave.
675+
676+
--workspace-prebuilds-reconciliation-interval duration, $CODER_WORKSPACE_PREBUILDS_RECONCILIATION_INTERVAL (default: 15s)
677+
How often to reconcile workspace prebuilds state.
678+
673679
⚠️ DANGEROUS OPTIONS:
674680
--dangerous-allow-path-app-sharing bool, $CODER_DANGEROUS_ALLOW_PATH_APP_SHARING
675681
Allow workspace apps that are not served from subdomains to be shared.

cli/testdata/server-config.yaml.golden

+12
Original file line numberDiff line numberDiff line change
@@ -688,3 +688,15 @@ notifications:
688688
# How often to query the database for queued notifications.
689689
# (default: 15s, type: duration)
690690
fetchInterval: 15s
691+
# Configure how workspace prebuilds behave.
692+
workspace_prebuilds:
693+
# How often to reconcile workspace prebuilds state.
694+
# (default: 15s, type: duration)
695+
reconciliation_interval: 15s
696+
# Interval to increase reconciliation backoff by when unrecoverable errors occur.
697+
# (default: 15s, type: duration)
698+
reconciliation_backoff_interval: 15s
699+
# Interval to look back to determine number of failed builds, which influences
700+
# backoff.
701+
# (default: 1h0m0s, type: duration)
702+
reconciliation_backoff_lookback_period: 1h0m0s

coderd/apidoc/docs.go

+23
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

+23
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codersdk/deployment.go

+48-1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ const (
8181
FeatureControlSharedPorts FeatureName = "control_shared_ports"
8282
FeatureCustomRoles FeatureName = "custom_roles"
8383
FeatureMultipleOrganizations FeatureName = "multiple_organizations"
84+
FeatureWorkspacePrebuilds FeatureName = "workspace_prebuilds"
8485
)
8586

8687
// FeatureNames must be kept in-sync with the Feature enum above.
@@ -103,6 +104,7 @@ var FeatureNames = []FeatureName{
103104
FeatureControlSharedPorts,
104105
FeatureCustomRoles,
105106
FeatureMultipleOrganizations,
107+
FeatureWorkspacePrebuilds,
106108
}
107109

108110
// Humanize returns the feature name in a human-readable format.
@@ -132,6 +134,7 @@ func (n FeatureName) AlwaysEnable() bool {
132134
FeatureHighAvailability: true,
133135
FeatureCustomRoles: true,
134136
FeatureMultipleOrganizations: true,
137+
FeatureWorkspacePrebuilds: true,
135138
}[n]
136139
}
137140

@@ -393,6 +396,7 @@ type DeploymentValues struct {
393396
TermsOfServiceURL serpent.String `json:"terms_of_service_url,omitempty" typescript:",notnull"`
394397
Notifications NotificationsConfig `json:"notifications,omitempty" typescript:",notnull"`
395398
AdditionalCSPPolicy serpent.StringArray `json:"additional_csp_policy,omitempty" typescript:",notnull"`
399+
Prebuilds PrebuildsConfig `json:"workspace_prebuilds,omitempty" typescript:",notnull"`
396400
WorkspaceHostnameSuffix serpent.String `json:"workspace_hostname_suffix,omitempty" typescript:",notnull"`
397401

398402
Config serpent.YAMLConfigPath `json:"config,omitempty" typescript:",notnull"`
@@ -1034,6 +1038,11 @@ func (c *DeploymentValues) Options() serpent.OptionSet {
10341038
Parent: &deploymentGroupNotifications,
10351039
YAML: "webhook",
10361040
}
1041+
deploymentGroupPrebuilds = serpent.Group{
1042+
Name: "Workspace Prebuilds",
1043+
YAML: "workspace_prebuilds",
1044+
Description: "Configure how workspace prebuilds behave.",
1045+
}
10371046
deploymentGroupInbox = serpent.Group{
10381047
Name: "Inbox",
10391048
Parent: &deploymentGroupNotifications,
@@ -3029,6 +3038,41 @@ Write out the current server config as YAML to stdout.`,
30293038
Annotations: serpent.Annotations{}.Mark(annotationFormatDuration, "true"),
30303039
Hidden: true, // Hidden because most operators should not need to modify this.
30313040
},
3041+
{
3042+
Name: "Reconciliation Interval",
3043+
Description: "How often to reconcile workspace prebuilds state.",
3044+
Flag: "workspace-prebuilds-reconciliation-interval",
3045+
Env: "CODER_WORKSPACE_PREBUILDS_RECONCILIATION_INTERVAL",
3046+
Value: &c.Prebuilds.ReconciliationInterval,
3047+
Default: (time.Second * 15).String(),
3048+
Group: &deploymentGroupPrebuilds,
3049+
YAML: "reconciliation_interval",
3050+
Annotations: serpent.Annotations{}.Mark(annotationFormatDuration, "true"),
3051+
},
3052+
{
3053+
Name: "Reconciliation Backoff Interval",
3054+
Description: "Interval to increase reconciliation backoff by when unrecoverable errors occur.",
3055+
Flag: "workspace-prebuilds-reconciliation-backoff-interval",
3056+
Env: "CODER_WORKSPACE_PREBUILDS_RECONCILIATION_BACKOFF_INTERVAL",
3057+
Value: &c.Prebuilds.ReconciliationBackoffInterval,
3058+
Default: (time.Second * 15).String(),
3059+
Group: &deploymentGroupPrebuilds,
3060+
YAML: "reconciliation_backoff_interval",
3061+
Annotations: serpent.Annotations{}.Mark(annotationFormatDuration, "true"),
3062+
Hidden: true,
3063+
},
3064+
{
3065+
Name: "Reconciliation Backoff Lookback Period",
3066+
Description: "Interval to look back to determine number of failed builds, which influences backoff.",
3067+
Flag: "workspace-prebuilds-reconciliation-backoff-lookback-period",
3068+
Env: "CODER_WORKSPACE_PREBUILDS_RECONCILIATION_BACKOFF_LOOKBACK_PERIOD",
3069+
Value: &c.Prebuilds.ReconciliationBackoffLookback,
3070+
Default: (time.Hour).String(), // TODO: use https://pkg.go.dev/github.com/jackc/[email protected]#Interval
3071+
Group: &deploymentGroupPrebuilds,
3072+
YAML: "reconciliation_backoff_lookback_period",
3073+
Annotations: serpent.Annotations{}.Mark(annotationFormatDuration, "true"),
3074+
Hidden: true,
3075+
},
30323076
// Push notifications.
30333077
}
30343078

@@ -3254,6 +3298,7 @@ const (
32543298
ExperimentAutoFillParameters Experiment = "auto-fill-parameters" // This should not be taken out of experiments until we have redesigned the feature.
32553299
ExperimentNotifications Experiment = "notifications" // Sends notifications via SMTP and webhooks following certain events.
32563300
ExperimentWorkspaceUsage Experiment = "workspace-usage" // Enables the new workspace usage tracking.
3301+
ExperimentWorkspacePrebuilds Experiment = "workspace-prebuilds" // Enables the new workspace prebuilds feature.
32573302
ExperimentWebPush Experiment = "web-push" // Enables web push notifications through the browser.
32583303
ExperimentDynamicParameters Experiment = "dynamic-parameters" // Enables dynamic parameters when creating a workspace.
32593304
)
@@ -3262,7 +3307,9 @@ const (
32623307
// users to opt-in to via --experimental='*'.
32633308
// Experiments that are not ready for consumption by all users should
32643309
// not be included here and will be essentially hidden.
3265-
var ExperimentsSafe = Experiments{}
3310+
var ExperimentsSafe = Experiments{
3311+
ExperimentWorkspacePrebuilds,
3312+
}
32663313

32673314
// Experiments is a list of experiments.
32683315
// Multiple experiments may be enabled at the same time.

docs/reference/api/general.md

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/api/schemas.md

+30
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/cli/server.md

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

enterprise/cli/testdata/coder_server_--help.golden

+6
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,12 @@ workspaces stopping during the day due to template scheduling.
671671
must be *. Only one hour and minute can be specified (ranges or comma
672672
separated values are not supported).
673673

674+
WORKSPACE PREBUILDS OPTIONS:
675+
Configure how workspace prebuilds behave.
676+
677+
--workspace-prebuilds-reconciliation-interval duration, $CODER_WORKSPACE_PREBUILDS_RECONCILIATION_INTERVAL (default: 15s)
678+
How often to reconcile workspace prebuilds state.
679+
674680
⚠️ DANGEROUS OPTIONS:
675681
--dangerous-allow-path-app-sharing bool, $CODER_DANGEROUS_ALLOW_PATH_APP_SHARING
676682
Allow workspace apps that are not served from subdomains to be shared.

0 commit comments

Comments
 (0)