Skip to content

Commit 16a3c19

Browse files
committed
Simplify dormancy template
1 parent 299cd7f commit 16a3c19

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

coderd/autobuild/lifecycle_executor.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,10 @@ func (e *Executor) runOnce(t time.Time) Stats {
332332
*dormantNotification,
333333
)
334334
if err != nil {
335-
e.log.Warn(e.ctx, "failed to notify of workspace marked as dormant", slog.Error(err), slog.F("workspace_id", dormantNotification.Workspace.ID))
335+
log.Warn(e.ctx, "failed to notify of workspace marked as dormant", slog.Error(err), slog.F("workspace_id", dormantNotification.Workspace.ID))
336336
}
337+
} else {
338+
log.Warn(e.ctx, "no dormant notification to send", slog.F("workspace_id", wsID))
337339
}
338340
return nil
339341
}()
Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1-
INSERT INTO notification_templates (id, name, title_template, body_template, "group", actions)
2-
VALUES ('0ea69165-ec14-4314-91f1-69566ac3c5a0', 'Workspace Marked as Dormant', E'Workspace "{{.Labels.name}}" marked as dormant',
3-
E'Hi {{.UserName}}\n\n' ||
4-
E'Your workspace **{{.Labels.name}}** has been marked as **dormant**.\n' ||
5-
E'The specified reason was "**{{.Labels.reason}}{{ if .Labels.initiator }} (initiated by: {{ .Labels.initiator }}){{end}}**\n\n' ||
6-
E'Dormancy refers to a workspace being unused for a defined length of time, and after it exceeds {{.Labels.dormancyHours}} hours of dormancy it will be deleted.\n' ||
7-
E'To prevent your workspace from being deleted, simply use it as normal.',
8-
'Workspace Events', '[
1+
INSERT INTO
2+
notification_templates (
3+
id,
4+
name,
5+
title_template,
6+
body_template,
7+
"group",
8+
actions
9+
)
10+
VALUES (
11+
'0ea69165-ec14-4314-91f1-69566ac3c5a0',
12+
'Workspace Marked as Dormant',
13+
E'Workspace "{{.Labels.name}}" marked as dormant',
14+
E'Hi {{.UserName}}\n\n' || E'Your workspace **{{.Labels.name}}** has been marked as **dormant**.\n' || E'The specified reason was "**{{.Labels.reason}} (initiated by: {{ .Labels.initiator }}){{end}}**\n\n' || E'Dormancy refers to a workspace being unused for a defined length of time, and after it exceeds {{.Labels.dormancyHours}} hours of dormancy it will be deleted.\n' || E'To prevent your workspace from being deleted, simply use it as normal.',
15+
'Workspace Events',
16+
'[
917
{
1018
"label": "View workspace",
1119
"url": "{{ base_url }}/@{{.UserName}}/{{.Labels.name}}"
1220
}
13-
]'::jsonb);
21+
]'::jsonb
22+
);

0 commit comments

Comments
 (0)