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

Skip to content

Commit c84aaee

Browse files
chore: update call to action
The CTA should link to a list of every affected workspace
1 parent 18a9a2e commit c84aaee

File tree

5 files changed

+61
-7
lines changed

5 files changed

+61
-7
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
UPDATE notification_templates
2+
SET
3+
name = 'Report: Workspace Builds Failed For Template',
4+
title_template = E'Workspace builds failed for template "{{.Labels.template_display_name}}"',
5+
body_template = E'Template **{{.Labels.template_display_name}}** has failed to build {{.Data.failed_builds}}/{{.Data.total_builds}} times over the last {{.Data.report_frequency}}.
6+
7+
**Report:**
8+
{{range $version := .Data.template_versions}}
9+
**{{$version.template_version_name}}** failed {{$version.failed_count}} time{{if gt $version.failed_count 1.0}}s{{end}}:
10+
{{range $build := $version.failed_builds}}
11+
* [{{$build.workspace_owner_username}} / {{$build.workspace_name}} / #{{$build.build_number}}]({{base_url}}/@{{$build.workspace_owner_username}}/{{$build.workspace_name}}/builds/{{$build.build_number}})
12+
{{- end}}
13+
{{end}}
14+
We recommend reviewing these issues to ensure future builds are successful.',
15+
actions = '[
16+
{
17+
"label": "View workspaces",
18+
"url": "{{ base_url }}/workspaces?filter=template%3A{{.Labels.template_name}}"
19+
}
20+
]'::jsonb)
21+
WHERE id = '34a20db2-e9cc-4a93-b0e4-8569699d7a00';

coderd/database/migrations/000316_group_build_failure_notifications.up.sql

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,11 @@ E'The following templates have had build failures over the last {{.Data.report_f
1919
{{end}}
2020
{{end}}
2121
22-
We recommend reviewing these issues to ensure future builds are successful.'
22+
We recommend reviewing these issues to ensure future builds are successful.',
23+
actions = '[
24+
{
25+
"label": "View workspaces",
26+
"url": "{{ base_url }}/workspaces?filter={{$first := true}}{{range $template := .Data.templates}}{{range $version := $template.versions}}{{range $build := $version.failed_builds}}{{if not $first}}+{{else}}{{$first = false}}{{end}}id%3A{{$build.workspace_id}}{{end}}{{end}}{{end}}"
27+
}
28+
]'::jsonb
2329
WHERE id = '34a20db2-e9cc-4a93-b0e4-8569699d7a00';

coderd/notifications/notifications_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -996,16 +996,19 @@ func TestNotificationTemplates_Golden(t *testing.T) {
996996
{
997997
"workspace_owner_username": "mtojek",
998998
"workspace_name": "workspace-1",
999+
"workspace_id": "24f5bd8f-1566-4374-9734-c3efa0454dc7",
9991000
"build_number": 1234.0,
10001001
},
10011002
{
10021003
"workspace_owner_username": "johndoe",
10031004
"workspace_name": "my-workspace-3",
1005+
"workspace_id": "372a194b-dcde-43f1-b7cf-8a2f3d3114a0",
10041006
"build_number": 5678.0,
10051007
},
10061008
{
10071009
"workspace_owner_username": "jack",
10081010
"workspace_name": "workwork",
1011+
"workspace_id": "1386d294-19c1-4351-89e2-6cae1afb9bfe",
10091012
"build_number": 774.0,
10101013
},
10111014
},
@@ -1017,6 +1020,7 @@ func TestNotificationTemplates_Golden(t *testing.T) {
10171020
{
10181021
"workspace_owner_username": "ben",
10191022
"workspace_name": "cool-workspace",
1023+
"workspace_id": "86fd99b1-1b6e-4b7e-b58e-0aee6e35c159",
10201024
"build_number": 8888.0,
10211025
},
10221026
},
@@ -1036,16 +1040,19 @@ func TestNotificationTemplates_Golden(t *testing.T) {
10361040
{
10371041
"workspace_owner_username": "daniellemaywood",
10381042
"workspace_name": "workspace-9",
1043+
"workspace_id": "cd469690-b6eb-4123-b759-980be7a7b278",
10391044
"build_number": 9234.0,
10401045
},
10411046
{
10421047
"workspace_owner_username": "johndoe",
10431048
"workspace_name": "my-workspace-7",
1049+
"workspace_id": "c447d472-0800-4529-a836-788754d5e27d",
10441050
"build_number": 8678.0,
10451051
},
10461052
{
10471053
"workspace_owner_username": "jack",
10481054
"workspace_name": "workworkwork",
1055+
"workspace_id": "919db6df-48f0-4dc1-b357-9036a2c40f86",
10491056
"build_number": 374.0,
10501057
},
10511058
},
@@ -1057,11 +1064,13 @@ func TestNotificationTemplates_Golden(t *testing.T) {
10571064
{
10581065
"workspace_owner_username": "ben",
10591066
"workspace_name": "more-cool-workspace",
1067+
"workspace_id": "c8fb0652-9290-4bf2-a711-71b910243ac2",
10601068
"build_number": 8878.0,
10611069
},
10621070
{
10631071
"workspace_owner_username": "ben",
10641072
"workspace_name": "less-cool-workspace",
1073+
"workspace_id": "703d718d-2234-4990-9a02-5b1df6cf462a",
10651074
"build_number": 8848.0,
10661075
},
10671076
},

coderd/notifications/testdata/rendered-templates/smtp/TemplateWorkspaceBuildsFailedReport.html.golden

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,12 @@ pace/builds/8848)
5151
We recommend reviewing these issues to ensure future builds are successful.
5252

5353

54-
View workspaces: http://test.com/workspaces?filter=3Dtemplate%3A<no value>
54+
View workspaces: http://test.com/workspaces?filter=3Did%3A24f5bd8f-1566-437=
55+
4-9734-c3efa0454dc7+id%3A372a194b-dcde-43f1-b7cf-8a2f3d3114a0+id%3A1386d294=
56+
-19c1-4351-89e2-6cae1afb9bfe+id%3A86fd99b1-1b6e-4b7e-b58e-0aee6e35c159+id%3=
57+
Acd469690-b6eb-4123-b759-980be7a7b278+id%3Ac447d472-0800-4529-a836-788754d5=
58+
e27d+id%3A919db6df-48f0-4dc1-b357-9036a2c40f86+id%3Ac8fb0652-9290-4bf2-a711=
59+
-71b910243ac2+id%3A703d718d-2234-4990-9a02-5b1df6cf462a
5560

5661
--bbe61b741255b6098bb6b3c1f41b885773df633cb18d2a3002b68e4bc9c4
5762
Content-Transfer-Encoding: quoted-printable
@@ -152,10 +157,14 @@ ul.</p>
152157
</div>
153158
<div style=3D"text-align: center; margin-top: 32px;">
154159
=20
155-
<a href=3D"http://test.com/workspaces?filter=3Dtemplate%3A<no value=
156-
>" style=3D"display: inline-block; padding: 13px 24px; background-color: #0=
157-
20617; color: #f8fafc; text-decoration: none; border-radius: 8px; margin: 0=
158-
4px;">
160+
<a href=3D"http://test.com/workspaces?filter=3Did%3A24f5bd8f-1566-4=
161+
374-9734-c3efa0454dc7+id%3A372a194b-dcde-43f1-b7cf-8a2f3d3114a0+id%3A1386d2=
162+
94-19c1-4351-89e2-6cae1afb9bfe+id%3A86fd99b1-1b6e-4b7e-b58e-0aee6e35c159+id=
163+
%3Acd469690-b6eb-4123-b759-980be7a7b278+id%3Ac447d472-0800-4529-a836-788754=
164+
d5e27d+id%3A919db6df-48f0-4dc1-b357-9036a2c40f86+id%3Ac8fb0652-9290-4bf2-a7=
165+
11-71b910243ac2+id%3A703d718d-2234-4990-9a02-5b1df6cf462a" style=3D"display=
166+
: inline-block; padding: 13px 24px; background-color: #020617; color: #f8fa=
167+
fc; text-decoration: none; border-radius: 8px; margin: 0 4px;">
159168
View workspaces
160169
</a>
161170
=20

coderd/notifications/testdata/rendered-templates/webhook/TemplateWorkspaceBuildsFailedReport.json.golden

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"actions": [
1313
{
1414
"label": "View workspaces",
15-
"url": "http://test.com/workspaces?filter=template%3A\u003cno value\u003e"
15+
"url": "http://test.com/workspaces?filter=id%3A00000000-0000-0000-0000-000000000000+id%3A00000000-0000-0000-0000-000000000000+id%3A00000000-0000-0000-0000-000000000000+id%3A00000000-0000-0000-0000-000000000000+id%3A00000000-0000-0000-0000-000000000000+id%3A00000000-0000-0000-0000-000000000000+id%3A00000000-0000-0000-0000-000000000000+id%3A00000000-0000-0000-0000-000000000000+id%3A00000000-0000-0000-0000-000000000000"
1616
}
1717
],
1818
"labels": {},
@@ -29,16 +29,19 @@
2929
"failed_builds": [
3030
{
3131
"build_number": 1234,
32+
"workspace_id": "00000000-0000-0000-0000-000000000000",
3233
"workspace_name": "workspace-1",
3334
"workspace_owner_username": "mtojek"
3435
},
3536
{
3637
"build_number": 5678,
38+
"workspace_id": "00000000-0000-0000-0000-000000000000",
3739
"workspace_name": "my-workspace-3",
3840
"workspace_owner_username": "johndoe"
3941
},
4042
{
4143
"build_number": 774,
44+
"workspace_id": "00000000-0000-0000-0000-000000000000",
4245
"workspace_name": "workwork",
4346
"workspace_owner_username": "jack"
4447
}
@@ -50,6 +53,7 @@
5053
"failed_builds": [
5154
{
5255
"build_number": 8888,
56+
"workspace_id": "00000000-0000-0000-0000-000000000000",
5357
"workspace_name": "cool-workspace",
5458
"workspace_owner_username": "ben"
5559
}
@@ -69,16 +73,19 @@
6973
"failed_builds": [
7074
{
7175
"build_number": 9234,
76+
"workspace_id": "00000000-0000-0000-0000-000000000000",
7277
"workspace_name": "workspace-9",
7378
"workspace_owner_username": "daniellemaywood"
7479
},
7580
{
7681
"build_number": 8678,
82+
"workspace_id": "00000000-0000-0000-0000-000000000000",
7783
"workspace_name": "my-workspace-7",
7884
"workspace_owner_username": "johndoe"
7985
},
8086
{
8187
"build_number": 374,
88+
"workspace_id": "00000000-0000-0000-0000-000000000000",
8289
"workspace_name": "workworkwork",
8390
"workspace_owner_username": "jack"
8491
}
@@ -90,11 +97,13 @@
9097
"failed_builds": [
9198
{
9299
"build_number": 8878,
100+
"workspace_id": "00000000-0000-0000-0000-000000000000",
93101
"workspace_name": "more-cool-workspace",
94102
"workspace_owner_username": "ben"
95103
},
96104
{
97105
"build_number": 8848,
106+
"workspace_id": "00000000-0000-0000-0000-000000000000",
98107
"workspace_name": "less-cool-workspace",
99108
"workspace_owner_username": "ben"
100109
}

0 commit comments

Comments
 (0)