- Notifications
You must be signed in to change notification settings - Fork927
feat: notify about manual failed builds#14419
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
coderd/database/migrations/000248_notifications_manual_build_failed.up.sql OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
assert.Equal(t, notifEnq.Sent[0].UserID, templateAdmin.ID) | ||
assert.Equal(t, notifEnq.Sent[0].TemplateID, notifications.TemplateWorkspaceManualBuildFailed) | ||
assert.Contains(t, notifEnq.Sent[0].Targets, template.ID) | ||
assert.Contains(t, notifEnq.Sent[0].Targets, workspace.ID) | ||
assert.Contains(t, notifEnq.Sent[0].Targets, workspace.OrganizationID) | ||
assert.Contains(t, notifEnq.Sent[0].Targets, user.ID) | ||
assert.Equal(t, workspace.Name, notifEnq.Sent[0].Labels["name"]) | ||
assert.Equal(t, template.Name, notifEnq.Sent[0].Labels["template_name"]) | ||
assert.Equal(t, version.Name, notifEnq.Sent[0].Labels["template_version_name"]) | ||
assert.Equal(t, user.Username, notifEnq.Sent[0].Labels["initiator"]) | ||
assert.Equal(t, user.Username, notifEnq.Sent[0].Labels["workspace_owner_username"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I feel like these assertions could be passed into the previous table-based test "Workspace build failed"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
There is a significant difference as here we expect notifications sent only to template admins, we don't care about workspace owners. I tried to squeeze this unit test as much as possible.
coderd/database/migrations/000248_notifications_manual_build_failed.up.sql OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
@@ -1150,15 +1130,43 @@ func (s *server) notifyWorkspaceManualBuildFailed(ctx context.Context, workspace | |||
"template_version_name": templateVersion.Name, | |||
"initiator": build.InitiatorByUsername, | |||
"workspace_owner_username": workspaceOwner.Username, | |||
"workspace_build_number": strconv.Itoa(int(build.BuildNumber)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Including this will mean that deduplication won't be possible, just so you're aware.
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
👍
Uh oh!
There was an error while loading.Please reload this page.
47f2c7d
intomainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Fixes:coder/internal#16
This PR modifies ProvisionerdServer to notify template admins about manual workspace build failures.