8000 feat: graduate prebuilds to general availability (#18607) · coder/coder@c6e0ba1 · GitHub
[go: up one dir, main page]

Skip to content

Commit c6e0ba1

Browse files
authored
feat: graduate prebuilds to general availability (#18607)
This PR removes the prebuilds experiment and allows the use of prebuilds without opting into an experiment.
1 parent 872aef3 commit c6e0ba1

File tree

17 files changed

+46
-88
lines changed

17 files changed

+46
-88
lines changed

cli/testdata/coder_server_--help.golden

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,12 @@ workspaces stopping during the day due to template scheduling.
677677
must be *. Only one hour and minute can be specified (ranges or comma
678678
separated values are not supported).
679679

680+
WORKSPACE PREBUILDS OPTIONS:
681+
Configure how workspace prebuilds behave.
682+
683+
--workspace-prebuilds-reconciliation-interval duration, $CODER_WORKSPACE_PREBUILDS_RECONCILIATION_INTERVAL (default: 15s)
684+
How often to reconcile workspace prebuilds state.
685+
680686
⚠️ DANGEROUS OPTIONS:
681687
--dangerous-allow-path-app-sharing bool, $CODER_DANGEROUS_ALLOW_PATH_APP_SHARING
682688
Allow workspace apps that are not served from subdomains to be shared.

coderd/apidoc/docs.go

Lines changed: 2 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

Lines changed: 2 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/dbauthz/dbauthz_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5059,8 +5059,7 @@ func (s *MethodTestSuite) TestPrebuilds() {
50595059
}))
50605060
s.Run("GetPrebuildMetrics", s.Subtest(func(_ database.Store, check *expects) {
50615061
check.Args().
5062-
Asserts(rbac.ResourceWorkspace.All(), policy.ActionRead).
5063-
ErrorsWithInMemDB(dbmem.ErrUnimplemented)
5062+
Asserts(rbac.ResourceWorkspace.All(), policy.ActionRead)
50645063
}))
50655064
s.Run("CountInProgressPrebuilds", s.Subtest(func(_ database.Store, check *expects) {
50665065
check.Args().

coderd/database/dbmem/dbmem.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4270,7 +4270,7 @@ func (q *FakeQuerier) GetParameterSchemasByJobID(_ context.Context, jobID uuid.U
42704270
}
42714271

42724272
func (*FakeQuerier) GetPrebuildMetrics(_ context.Context) ([]database.GetPrebuildMetricsRow, error) {
4273-
return nil, ErrUnimplemented
4273+
return make([]database.GetPrebuildMetricsRow, 0), nil
42744274
}
42754275

42764276
func (q *FakeQuerier) GetPresetByID(ctx context.Context, presetID uuid.UUID) (database.GetPresetByIDRow, error) {

coderd/telemetry/telemetry.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -687,10 +687,6 @@ func (r *remoteReporter) createSnapshot() (*Snapshot, error) {
687687
return nil
688688
})
689689
eg.Go(func() error {
690-
if !r.options.Experiments.Enabled(codersdk.ExperimentWorkspacePrebuilds) {
691-
return nil
692-
}
693-
694690
metrics, err := r.options.Database.GetPrebuildMetrics(ctx)
695691
if err != nil {
696692
return xerrors.Errorf("get prebuild metrics: %w", err)

coderd/telemetry/telemetry_test.go

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -408,16 +408,14 @@ func TestPrebuiltWorkspacesTelemetry(t *testing.T) {
408408

409409
cases := []struct {
410410
name string
411-
experimentEnabled bool
412411
storeFn func(store database.Store) database.Store
413412
expectedSnapshotEntries int
414413
expectedCreated int
415414
expectedFailed int
416415
expectedClaimed int
417416
}{
418417
{
419-
name: "experiment enabled",
420-
experimentEnabled: true,
418+
name: "prebuilds enabled",
421419
storeFn: func(store database.Store) database.Store {
422420
return &mockDB{Store: store}
423421
},
@@ -427,19 +425,11 @@ func TestPrebuiltWorkspacesTelemetry(t *testing.T) {
427425
expectedClaimed: 3,
428426
},
429427
{
430-
name: "experiment enabled, prebuilds not used",
431-
experimentEnabled: true,
428+
name: "prebuilds not used",
432429
storeFn: func(store database.Store) database.Store {
433430
return &emptyMockDB{Store: store}
434431
},
435432
},
436-
{
437-
name: "experiment disabled",
438-
experimentEnabled: false,
439-
storeFn: func(store database.Store) database.Store {
440-
return &mockDB{Store: store}
441-
},
442-
},
443433
}
444434

445435
for _, tc := range cases {
@@ -448,11 +438,6 @@ func TestPrebuiltWorkspacesTelemetry(t *testing.T) {
448438

449439
deployment, snapshot := collectSnapshot(ctx, t, db, func(opts telemetry.Options) telemetry.Options {
450440
opts.Database = tc.storeFn(db)
451-
if tc.experimentEnabled {
452-
opts.Experiments = codersdk.Experiments{
453-
codersdk.ExperimentWorkspacePrebuilds,
454-
}
455-
}
456441
return opts
457442
})
458443

codersdk/deployment.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3070,7 +3070,6 @@ Write out the current server config as YAML to stdout.`,
30703070
Group: &deploymentGroupPrebuilds,
30713071
YAML: "reconciliation_interval",
30723072
Annotations: serpent.Annotations{}.Mark(annotationFormatDuration, "true"),
3073-
Hidden: ExperimentsSafe.Enabled(ExperimentWorkspacePrebuilds), // Hide setting while this feature is experimental.
30743073
},
30753074
{
30763075
Name: "Reconciliation Backoff Interval",
@@ -3342,7 +3341,6 @@ const (
33423341
ExperimentNotifications Experiment = "notifications" // Sends notifications via SMTP and webhooks following certain events.
33433342
ExperimentWorkspaceUsage Experiment = "workspace-usage" // Enables the new workspace usage tracking.
33443343
ExperimentWebPush Experiment = "web-push" // Enables web push notifications through the browser.
3345-
ExperimentWorkspacePrebuilds Experiment = "workspace-prebuilds" // Enables the new workspace prebuilds feature.
33463344
)
33473345

33483346
// ExperimentsKnown should include all experiments defined above.
@@ -3352,16 +3350,13 @@ var ExperimentsKnown = Experiments{
33523350
ExperimentNotifications,
33533351
ExperimentWorkspaceUsage,
33543352
ExperimentWebPush,
3355-
ExperimentWorkspacePrebuilds,
33563353
}
33573354

33583355
// ExperimentsSafe should include all experiments that are safe for
33593356
// users to opt-in to via --experimental='*'.
33603357
// Experiments that are not ready for consumption by all users should
33613358
// not be included here and will be essentially hidden.
3362-
var ExperimentsSafe = Experiments{
3363-
ExperimentWorkspacePrebuilds,
3364-
}
3359+
var ExperimentsSafe = Experiments{}
33653360

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

docs/admin/templates/extending-templates/prebuilt-workspaces.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ Prebuilt workspaces are tightly integrated with [workspace presets](./parameters
2727

2828
- [**Premium license**](../../licensing/index.md)
2929
- **Compatible Terraform provider**: Use `coder/coder` Terraform provider `>= 2.4.1`.
30-
- **Feature flag**: Enable the `workspace-prebuilds` [experiment](../../../reference/cli/server.md#--experiments).
3130

3231
## Enable prebuilt workspaces for template presets
3332

docs/reference/api/schemas.md

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/cli/server.md

Lines changed: 11 additions & 0 deletions
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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,12 @@ workspaces stopping during the day due to template scheduling.
678678
must be *. Only one hour and minute can be specified (ranges or comma
679679
separated values are not supported).
680680

681+
WORKSPACE PREBUILDS OPTIONS:
682+
Configure how workspace prebuilds behave.
683+
684+
--workspace-prebuilds-reconciliation-interval duration, $CODER_WORKSPACE_PREBUILDS_RECONCILIATION_INTERVAL (default: 15s)
685+
How often to reconcile workspace prebuilds state.
686+
681687
⚠️ DANGEROUS OPTIONS:
682688
--dangerous-allow-path-app-sharing bool, $CODER_DANGEROUS_ALLOW_PATH_APP_SHARING
683689
Allow workspace apps that are not served from subdomains to be shared.

enterprise/coderd/coderd.go

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,16 +1150,9 @@ func (api *API) Authorize(r *http.Request, action policy.Action, object rbac.Obj
11501150

11511151
// nolint:revive // featureEnabled is a legit control flag.
11521152
func (api *API) setupPrebuilds(featureEnabled bool) (agplprebuilds.ReconciliationOrchestrator, agplprebuilds.Claimer) {
1153-
experimentEnabled := api.AGPL.Experiments.Enabled(codersdk.ExperimentWorkspacePrebuilds)
1154-
if !experimentEnabled || !featureEnabled {
1155-
levelFn := api.Logger.Debug
1156-
// If the experiment is enabled but the license does not entitle the feature, operators should be warned.
1157-
if !featureEnabled {
1158-
levelFn = api.Logger.Warn
1159-
}
1160-
1161-
levelFn(context.Background(), "prebuilds not enabled; ensure you have a premium license and the 'workspace-prebuilds' experiment set",
1162-
slog.F("experiment_enabled", experimentEnabled), slog.F("feature_enabled", featureEnabled))
1153+
if !featureEnabled {
1154+
api.Logger.Warn(context.Background(), "prebuilds not enabled; ensure you have a premium license",
1155+
slog.F("feature_enabled", featureEnabled))
11631156

11641157
return agplprebuilds.DefaultReconciler, agplprebuilds.DefaultClaimer
11651158
}

enterprise/coderd/coderd_test.go

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -260,34 +260,19 @@ func TestEntitlements_Prebuilds(t *testing.T) {
260260
t.Parallel()
261261

262262
cases := []struct {
263-
name string
264-
experimentEnabled bool
265-
featureEnabled bool
266-
expectedEnabled bool
263+
name string
264+
featureEnabled bool
265+
expectedEnabled bool
267266
}{
268267
{
269-
name: "Fully enabled",
270-
featureEnabled: true,
271-
experimentEnabled: true,
272-
expectedEnabled: true,
268+
name: "Feature enabled",
269+
featureEnabled: true,
270+
expectedEnabled: true,
273271
},
274272
{
275-
name: "Feature disabled",
276-
featureEnabled: false,
277-
experimentEnabled: true,
278-
expectedEnabled: false,
279-
},
280-
{
281-
name: "Experiment disabled",
282-
featureEnabled: true,
283-
experimentEnabled: false,
284-
expectedEnabled: false,
285-
},
286-
{
287-
name: "Fully disabled",
288-
featureEnabled: false,
289-
experimentEnabled: false,
290-
expectedEnabled: false,
273+
name: "Feature disabled",
274+
featureEnabled: false,
275+
expectedEnabled: false,
291276
},
292277
}
293278

@@ -302,11 +287,7 @@ func TestEntitlements_Prebuilds(t *testing.T) {
302287

303288
_, _, api, _ := coderdenttest.NewWithAPI(t, &coderdenttest.Options{
304289
Options: &coderdtest.Options{
305-
DeploymentValues: coderdtest.DeploymentValues(t, func(values *codersdk.DeploymentValues) {
306-
if tc.experimentEnabled {
307-
values.Experiments = serpent.StringArray{string(codersdk.ExperimentWorkspacePrebuilds)}
308-
}
309-
}),
290+
DeploymentValues: coderdtest.DeploymentValues(t),
310291
},
311292

312293
EntitlementsUpdateInterval: time.Second,

enterprise/coderd/workspaceagents_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ func TestReinitializeAgent(t *testing.T) {
112112
Pubsub: ps,
113113
DeploymentValues: coderdtest.DeploymentValues(t, func(dv *codersdk.DeploymentValues) {
114114
dv.Prebuilds.ReconciliationInterval = serpent.Duration(time.Second)
115-
dv.Experiments.Append(string(codersdk.ExperimentWorkspacePrebuilds))
116115
}),
117116
},
118117
LicenseOptions: &coderdenttest.LicenseOptions{

enterprise/coderd/workspaces_test.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -531,10 +531,7 @@ func TestCreateUserWorkspace(t *testing.T) {
531531

532532
client, db, user := coderdenttest.NewWithDatabase(t, &coderdenttest.Options{
533533
Options: &coderdtest.Options{
534-
DeploymentValues: coderdtest.DeploymentValues(t, func(dv *codersdk.DeploymentValues) {
535-
err := dv.Experiments.Append(string(codersdk.ExperimentWorkspacePrebuilds))
536-
require.NoError(t, err)
537-
}),
534+
DeploymentValues: coderdtest.DeploymentValues(t),
538535
},
539536
LicenseOptions: &coderdenttest.LicenseOptions{
540537
Features: license.Features{

site/src/api/typesGenerated.ts

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
0