Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Include template version message in workspace auto-updated template
Signed-off-by: Danny Kopping <danny@coder.com>
  • Loading branch information
dannykopping committed Aug 7, 2024
commit 326da9adb3093a6ac9afd3811adfda0608e90b02
10 changes: 6 additions & 4 deletions coderd/autobuild/lifecycle_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"golang.org/x/xerrors"

"cdr.dev/slog"

"github.com/coder/coder/v2/coderd/audit"
"github.com/coder/coder/v2/coderd/database"
"github.com/coder/coder/v2/coderd/database/dbauthz"
Expand Down Expand Up @@ -296,10 +297,11 @@ func (e *Executor) runOnce(t time.Time) Stats {

if _, err := e.notificationsEnqueuer.Enqueue(e.ctx, ws.OwnerID, notifications.TemplateWorkspaceAutoUpdated,
map[string]string{
"name": ws.Name,
"initiator": "autobuild",
"reason": nextBuildReason,
"template_version_name": activeTemplateVersion.Name,
"name": ws.Name,
"initiator": "autobuild",
"reason": nextBuildReason,
"template_version_name": activeTemplateVersion.Name,
"template_version_message": activeTemplateVersion.Message,
}, "autobuild",
// Associate this notification with all the related entities.
ws.ID, ws.OwnerID, ws.TemplateID, ws.OrganizationID,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
UPDATE notification_templates
SET body_template = E'Hi {{.UserName}}\n' ||
E'Your workspace **{{.Labels.name}}** has been updated automatically to the latest template version ({{.Labels.template_version_name}}).'
WHERE id = 'c34a0c09-0704-4cac-bd1c-0c0146811c2b';
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
UPDATE notification_templates
SET name = 'Workspace Updated Automatically', -- drive-by fix for capitalization to match other templates
body_template = E'Hi {{.UserName}}\n' ||
E'Your workspace **{{.Labels.name}}** has been updated automatically to the latest template version ({{.Labels.template_version_name}}).\n' ||
E'Reason for update: **{{.Labels.template_version_message}}**' -- include template version message
WHERE id = 'c34a0c09-0704-4cac-bd1c-0c0146811c2b';