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

Skip to content

Commit 3148702

Browse files
committed
chore: remove notifications experiment
Signed-off-by: Danny Kopping <[email protected]>
1 parent 5246f8d commit 3148702

File tree

8 files changed

+30
-42
lines changed

8 files changed

+30
-42
lines changed

cli/notifications_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ func createOpts(t *testing.T) *coderdtest.Options {
2020
t.Helper()
2121

2222
dt := coderdtest.DeploymentValues(t)
23-
dt.Experiments = []string{string(codersdk.ExperimentNotifications)}
2423
return &coderdtest.Options{
2524
DeploymentValues: dt,
2625
}

cli/server.go

+25-30
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,16 @@ import (
5656

5757
"cdr.dev/slog"
5858
"cdr.dev/slog/sloggers/sloghuman"
59-
"github.com/coder/coder/v2/coderd/entitlements"
60-
"github.com/coder/coder/v2/coderd/notifications/reports"
61-
"github.com/coder/coder/v2/coderd/runtimeconfig"
6259
"github.com/coder/pretty"
6360
"github.com/coder/quartz"
6461
"github.com/coder/retry"
6562
"github.com/coder/serpent"
6663
"github.com/coder/wgtunnel/tunnelsdk"
6764

65+
"github.com/coder/coder/v2/coderd/entitlements"
66+
"github.com/coder/coder/v2/coderd/notifications/reports"
67+
"github.com/coder/coder/v2/coderd/runtimeconfig"
68+
6869
"github.com/coder/coder/v2/buildinfo"
6970
"github.com/coder/coder/v2/cli/clilog"
7071
"github.com/coder/coder/v2/cli/cliui"
@@ -679,10 +680,6 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
679680
options.OIDCConfig = oc
680681
}
681682

682-
experiments := coderd.ReadExperiments(
683-
options.Logger, options.DeploymentValues.Experiments.Value(),
684-
)
685-
686683
// We'll read from this channel in the select below that tracks shutdown. If it remains
687684
// nil, that case of the select will just never fire, but it's important not to have a
688685
// "bare" read on this channel.
@@ -1006,33 +1003,31 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
10061003
var (
10071004
notificationsManager *notifications.Manager
10081005
)
1009-
if experiments.Enabled(codersdk.ExperimentNotifications) {
1010-
cfg := options.DeploymentValues.Notifications
1011-
metrics := notifications.NewMetrics(options.PrometheusRegistry)
1012-
helpers := templateHelpers(options)
1006+
cfg := options.DeploymentValues.Notifications
1007+
metrics := notifications.NewMetrics(options.PrometheusRegistry)
1008+
helpers := templateHelpers(options)
10131009

1014-
// The enqueuer is responsible for enqueueing notifications to the given store.
1015-
enqueuer, err := notifications.NewStoreEnqueuer(cfg, options.Database, helpers, logger.Named("notifications.enqueuer"), quartz.NewReal())
1016-
if err != nil {
1017-
return xerrors.Errorf("failed to instantiate notification store enqueuer: %w", err)
1018-
}
1019-
options.NotificationsEnqueuer = enqueuer
1010+
// The enqueuer is responsible for enqueueing notifications to the given store.
1011+
enqueuer, err := notifications.NewStoreEnqueuer(cfg, options.Database, helpers, logger.Named("notifications.enqueuer"), quartz.NewReal())
1012+
if err != nil {
1013+
return xerrors.Errorf("failed to instantiate notification store enqueuer: %w", err)
1014+
}
1015+
options.NotificationsEnqueuer = enqueuer
10201016

1021-
// The notification manager is responsible for:
1022-
// - creating notifiers and managing their lifecycles (notifiers are responsible for dequeueing/sending notifications)
1023-
// - keeping the store updated with status updates
1024-
notificationsManager, err = notifications.NewManager(cfg, options.Database, helpers, metrics, logger.Named("notifications.manager"))
1025-
if err != nil {
1026-
return xerrors.Errorf("failed to instantiate notification manager: %w", err)
1027-
}
1017+
// The notification manager is responsible for:
1018+
// - creating notifiers and managing their lifecycles (notifiers are responsible for dequeueing/sending notifications)
1019+
// - keeping the store updated with status updates
1020+
notificationsManager, err = notifications.NewManager(cfg, options.Database, helpers, metrics, logger.Named("notifications.manager"))
1021+
if err != nil {
1022+
return xerrors.Errorf("failed to instantiate notification manager: %w", err)
1023+
}
10281024

1029-
// nolint:gocritic // TODO: create own role.
1030-
notificationsManager.Run(dbauthz.AsSystemRestricted(ctx))
1025+
// nolint:gocritic // TODO: create own role.
1026+
notificationsManager.Run(dbauthz.AsSystemRestricted(ctx))
10311027

1032-
// Run report generator to distribute periodic reports.
1033-
notificationReportGenerator := reports.NewReportGenerator(ctx, logger.Named("notifications.report_generator"), options.Database, options.NotificationsEnqueuer, quartz.NewReal())
1034-
defer notificationReportGenerator.Close()
1035-
}
1028+
// Run report generator to distribute periodic reports.
1029+
notificationReportGenerator := reports.NewReportGenerator(ctx, logger.Named("notifications.report_generator"), options.Database, options.NotificationsEnqueuer, quartz.NewReal())
1030+
defer notificationReportGenerator.Close()
10361031

10371032
// Wrap the server in middleware that redirects to the access URL if
10381033
// the request is not to a local IP.

coderd/coderd.go

+4-6
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@ import (
3737
"tailscale.com/util/singleflight"
3838

3939
"cdr.dev/slog"
40+
"github.com/coder/quartz"
41+
"github.com/coder/serpent"
42+
4043
"github.com/coder/coder/v2/coderd/entitlements"
4144
"github.com/coder/coder/v2/coderd/idpsync"
4245
"github.com/coder/coder/v2/coderd/runtimeconfig"
43-
"github.com/coder/quartz"
44-
"github.com/coder/serpent"
4546

4647
agentproto "github.com/coder/coder/v2/agent/proto"
4748
"github.com/coder/coder/v2/buildinfo"
@@ -1257,10 +1258,7 @@ func New(options *Options) *API {
12571258
})
12581259
})
12591260
r.Route("/notifications", func(r chi.Router) {
1260-
r.Use(
1261-
apiKeyMiddleware,
1262-
httpmw.RequireExperiment(api.Experiments, codersdk.ExperimentNotifications),
1263-
)
1261+
r.Use(apiKeyMiddleware)
12641262
r.Get("/settings", api.notificationsSettings)
12651263
r.Put("/settings", api.putNotificationsSettings)
12661264
r.Route("/templates", func(r chi.Router) {

coderd/notifications/notifications_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,6 @@ func createOpts(t *testing.T) *coderdtest.Options {
11871187
t.Helper()
11881188

11891189
dt := coderdtest.DeploymentValues(t)
1190-
dt.Experiments = []string{string(codersdk.ExperimentNotifications)}
11911190
return &coderdtest.Options{
11921191
DeploymentValues: dt,
11931192
}

coderd/notifications_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ func createOpts(t *testing.T) *coderdtest.Options {
2020
t.Helper()
2121

2222
dt := coderdtest.DeploymentValues(t)
23-
dt.Experiments = []string{string(codersdk.ExperimentNotifications)}
2423
return &coderdtest.Options{
2524
DeploymentValues: dt,
2625
}

codersdk/deployment.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2901,7 +2901,7 @@ const (
29012901
// users to opt-in to via --experimental='*'.
29022902
// Experiments that are not ready for consumption by all users should
29032903
// not be included here and will be essentially hidden.
2904-
var ExperimentsAll = Experiments{ExperimentNotifications}
2904+
var ExperimentsAll = Experiments{}
29052905

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

enterprise/coderd/coderd.go

-1
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,6 @@ func New(ctx context.Context, options *Options) (_ *API, err error) {
448448
// with the below route, we need to register this route without any mounts or groups to make both work.
449449
r.With(
450450
apiKeyMiddleware,
451-
httpmw.RequireExperiment(api.AGPL.Experiments, codersdk.ExperimentNotifications),
452451
httpmw.ExtractNotificationTemplateParam(options.Database),
453452
).Put("/notifications/templates/{notification_template}/method", api.updateNotificationTemplateMethod)
454453
})

enterprise/coderd/notifications_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ func createOpts(t *testing.T) *coderdenttest.Options {
2323
t.Helper()
2424

2525
dt := coderdtest.DeploymentValues(t)
26-
dt.Experiments = []string{string(codersdk.ExperimentNotifications)}
2726
return &coderdenttest.Options{
2827
Options: &coderdtest.Options{
2928
DeploymentValues: dt,

0 commit comments

Comments
 (0)