- Notifications
You must be signed in to change notification settings - Fork1k
feat: implement thin vertical slice of system-generated notifications#13537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes from1 commit
Commits
Show all changes
30 commits Select commitHold shift + click to select a range
53c9cbb
feat: system-generated notifications
dannykopping4856aed
Fixing lint errors & minor tests
dannykoppingcda6efb
Fixing dbauthz test
dannykopping86f937a
TestBufferedUpdates does not need a real db, altering test details sl…
dannykoppinge8f1af2
Correct TestBufferedUpdates to count updated entries, use real db again
dannykoppinga056f54
Use UUID for notifier IDs
dannykopping8c64d30
Small improvements from review suggestions
dannykoppingac149ec
Protect notifiers from modification during Stop()
dannykopping884fadf
Split out enqueuer as separate responsibility, get rid of singleton
dannykopping4e362e7
Remove unnecessary handler registry
dannykopping8097290
Remove unused context
dannykopping1b841ad
Centralise markdown rendering
dannykopping61f5bd6
Appease the linter
dannykopping3c8e33b
Only enqueue notification when not initiated by self
dannykopping757327c
Hide config flags which are unlikely to be modified by operators
dannykopping6f909ae
Remove unnecessary Labels struct
dannykopping36698c5
Enable experiment as safe
dannykoppingc5701a6
Correcting bad refactor
dannykopping9d4c312
Initialize Enqueuer on API startup
dannykopping9380d8e
Only start one notifier since all dispatches are concurrent anyway
dannykopping4b7214d
Fix docs
dannykopping6679ef1
Fix lint error
dannykopping337997d
Merge branch 'main' of github.com:/coder/coder into dk/system-notific…
dannykoppingba5f7c6
Merge branch 'main' of github.com:/coder/coder into dk/system-notific…
dannykopping0f29293
Review feedback
dannykopping7c6c486
Merge branch 'main' of github.com:/coder/coder into dk/system-notific…
dannykoppingc6e75c2
Fix lint failures
dannykoppingaff9e6c
Review comments
dannykopping613e074
Avoid race by exposing number of pending updates
dannykoppingfaea7fc
Merge branch 'main' of github.com:/coder/coder into dk/system-notific…
dannykoppingFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
Hide config flags which are unlikely to be modified by operators
Signed-off-by: Danny Kopping <danny@coder.com>
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
commit757327c7ff297ec74a639502859a660118043adf
There are no files selected for viewing
38 changes: 0 additions & 38 deletionscli/testdata/coder_server_--help.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
40 changes: 20 additions & 20 deletionscli/testdata/server-config.yaml.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
128 changes: 68 additions & 60 deletionscodersdk/deployment.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -17,10 +17,11 @@ import ( | ||
"github.com/coreos/go-oidc/v3/oidc" | ||
"github.com/coder/serpent" | ||
"github.com/coder/coder/v2/buildinfo" | ||
"github.com/coder/coder/v2/coderd/agentmetrics" | ||
"github.com/coder/coder/v2/coderd/workspaceapps/appurl" | ||
) | ||
// Entitlement represents whether a feature is licensed. | ||
@@ -2085,6 +2086,65 @@ Write out the current server config as YAML to stdout.`, | ||
Annotations: serpent.Annotations{}.Mark(annotationFormatDuration, "true"), | ||
}, | ||
// Notifications Options | ||
{ | ||
Name: "Notifications: Method", | ||
Description: "Which delivery method to use (available options: 'smtp', 'webhook').", | ||
Flag: "notifications-method", | ||
Env: "CODER_NOTIFICATIONS_METHOD", | ||
Value: &c.Notifications.Method, | ||
Default: "smtp", | ||
Group: &deploymentGroupNotifications, | ||
YAML: "method", | ||
}, | ||
{ | ||
Name: "Notifications: Dispatch Timeout", | ||
Description: "How long to wait while a notification is being sent before giving up.", | ||
Flag: "notifications-dispatch-timeout", | ||
Env: "CODER_NOTIFICATIONS_DISPATCH_TIMEOUT", | ||
Value: &c.Notifications.DispatchTimeout, | ||
Default: time.Minute.String(), | ||
Group: &deploymentGroupNotifications, | ||
YAML: "dispatch-timeout", | ||
Annotations: serpent.Annotations{}.Mark(annotationFormatDuration, "true"), | ||
}, | ||
{ | ||
Name: "Notifications: Email: From Address", | ||
Description: "The sender's address to use.", | ||
Flag: "notifications-email-from", | ||
Env: "CODER_NOTIFICATIONS_EMAIL_FROM", | ||
Value: &c.Notifications.SMTP.From, | ||
Group: &deploymentGroupNotificationsEmail, | ||
YAML: "from", | ||
}, | ||
{ | ||
Name: "Notifications: Email: Smarthost", | ||
dannykopping marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
Description: "The intermediary SMTP host through which emails are sent.", | ||
Flag: "notifications-email-smarthost", | ||
Env: "CODER_NOTIFICATIONS_EMAIL_SMARTHOST", | ||
Default: "localhost:587", // To pass validation. | ||
Value: &c.Notifications.SMTP.Smarthost, | ||
Group: &deploymentGroupNotificationsEmail, | ||
YAML: "smarthost", | ||
}, | ||
{ | ||
Name: "Notifications: Email: Hello", | ||
Description: "The hostname identifying the SMTP server.", | ||
Flag: "notifications-email-hello", | ||
Env: "CODER_NOTIFICATIONS_EMAIL_HELLO", | ||
Default: "localhost", | ||
Value: &c.Notifications.SMTP.Hello, | ||
Group: &deploymentGroupNotificationsEmail, | ||
YAML: "hello", | ||
}, | ||
{ | ||
Name: "Notifications: Webhook: Endpoint", | ||
Description: "The endpoint to which to send webhooks.", | ||
Flag: "notifications-webhook-endpoint", | ||
Env: "CODER_NOTIFICATIONS_WEBHOOK_ENDPOINT", | ||
Value: &c.Notifications.Webhook.Endpoint, | ||
Group: &deploymentGroupNotificationsWebhook, | ||
YAML: "hello", | ||
}, | ||
{ | ||
Name: "Notifications: Max Send Attempts", | ||
Description: "The upper limit of attempts to send a notification.", | ||
@@ -2105,6 +2165,7 @@ Write out the current server config as YAML to stdout.`, | ||
Group: &deploymentGroupNotifications, | ||
YAML: "retry-interval", | ||
Annotations: serpent.Annotations{}.Mark(annotationFormatDuration, "true"), | ||
Hidden: true, // Hidden because most operators should not need to modify this. | ||
}, | ||
{ | ||
Name: "Notifications: Store Sync Interval", | ||
@@ -2119,6 +2180,7 @@ Write out the current server config as YAML to stdout.`, | ||
Group: &deploymentGroupNotifications, | ||
YAML: "store-sync-interval", | ||
Annotations: serpent.Annotations{}.Mark(annotationFormatDuration, "true"), | ||
Hidden: true, // Hidden because most operators should not need to modify this. | ||
}, | ||
{ | ||
Name: "Notifications: Store Sync Buffer Size", | ||
@@ -2132,6 +2194,7 @@ Write out the current server config as YAML to stdout.`, | ||
Default: "50", | ||
Group: &deploymentGroupNotifications, | ||
YAML: "store-sync-buffer-size", | ||
Hidden: true, // Hidden because most operators should not need to modify this. | ||
}, | ||
{ | ||
Name: "Notifications: Worker Count", | ||
@@ -2143,6 +2206,7 @@ Write out the current server config as YAML to stdout.`, | ||
Default: "2", | ||
Group: &deploymentGroupNotifications, | ||
YAML: "worker-count", | ||
Hidden: true, // Hidden because most operators should not need to modify this. | ||
}, | ||
{ | ||
Name: "Notifications: Lease Period", | ||
@@ -2158,6 +2222,7 @@ Write out the current server config as YAML to stdout.`, | ||
Group: &deploymentGroupNotifications, | ||
YAML: "lease-period", | ||
Annotations: serpent.Annotations{}.Mark(annotationFormatDuration, "true"), | ||
Hidden: true, // Hidden because most operators should not need to modify this. | ||
}, | ||
{ | ||
Name: "Notifications: Lease Count", | ||
@@ -2168,6 +2233,7 @@ Write out the current server config as YAML to stdout.`, | ||
Default: "10", | ||
Group: &deploymentGroupNotifications, | ||
YAML: "lease-count", | ||
Hidden: true, // Hidden because most operators should not need to modify this. | ||
}, | ||
{ | ||
Name: "Notifications: Fetch Interval", | ||
@@ -2179,65 +2245,7 @@ Write out the current server config as YAML to stdout.`, | ||
Group: &deploymentGroupNotifications, | ||
YAML: "fetch-interval", | ||
Annotations: serpent.Annotations{}.Mark(annotationFormatDuration, "true"), | ||
Hidden: true, // Hidden because most operators should not need to modify this. | ||
}, | ||
} | ||
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.