mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat(coderd/notifications): group workspace build failure report (#17306)
Closes https://github.com/coder/coder/issues/15745 Instead of sending X many reports to a single template admin, we instead send only 1.
This commit is contained in:
+98
-35
@@ -1,6 +1,6 @@
|
||||
From: system@coder.com
|
||||
To: bobby@coder.com
|
||||
Subject: Workspace builds failed for template "Bobby First Template"
|
||||
Subject: Failed workspace builds report
|
||||
Message-Id: 02ee4935-73be-4fa1-a290-ff9999026b13@blush-whale-48
|
||||
Date: Fri, 11 Oct 2024 09:03:06 +0000
|
||||
Content-Type: multipart/alternative; boundary=bbe61b741255b6098bb6b3c1f41b885773df633cb18d2a3002b68e4bc9c4
|
||||
@@ -12,29 +12,51 @@ Content-Type: text/plain; charset=UTF-8
|
||||
|
||||
Hi Bobby,
|
||||
|
||||
Template Bobby First Template has failed to build 4/55 times over the last =
|
||||
week.
|
||||
The following templates have had build failures over the last week:
|
||||
|
||||
Bobby First Template failed to build 4/55 times
|
||||
Bobby Second Template failed to build 5/50 times
|
||||
|
||||
Report:
|
||||
|
||||
Bobby First Template
|
||||
|
||||
bobby-template-version-1 failed 3 times:
|
||||
|
||||
mtojek / workspace-1 / #1234 (http://test.com/@mtojek/workspace-1/builds/12=
|
||||
34)
|
||||
johndoe / my-workspace-3 / #5678 (http://test.com/@johndoe/my-workspace-3/b=
|
||||
uilds/5678)
|
||||
jack / workwork / #774 (http://test.com/@jack/workwork/builds/774)
|
||||
|
||||
mtojek / workspace-1 / #1234 (http://test.com/@mtojek/workspace-1/build=
|
||||
s/1234)
|
||||
johndoe / my-workspace-3 / #5678 (http://test.com/@johndoe/my-workspace=
|
||||
-3/builds/5678)
|
||||
jack / workwork / #774 (http://test.com/@jack/workwork/builds/774)
|
||||
bobby-template-version-2 failed 1 time:
|
||||
ben / cool-workspace / #8888 (http://test.com/@ben/cool-workspace/build=
|
||||
s/8888)
|
||||
|
||||
|
||||
Bobby Second Template
|
||||
|
||||
bobby-template-version-1 failed 3 times:
|
||||
daniellemaywood / workspace-9 / #9234 (http://test.com/@daniellemaywood=
|
||||
/workspace-9/builds/9234)
|
||||
johndoe / my-workspace-7 / #8678 (http://test.com/@johndoe/my-workspace=
|
||||
-7/builds/8678)
|
||||
jack / workworkwork / #374 (http://test.com/@jack/workworkwork/builds/3=
|
||||
74)
|
||||
bobby-template-version-2 failed 2 times:
|
||||
ben / more-cool-workspace / #8878 (http://test.com/@ben/more-cool-works=
|
||||
pace/builds/8878)
|
||||
ben / less-cool-workspace / #8848 (http://test.com/@ben/less-cool-works=
|
||||
pace/builds/8848)
|
||||
|
||||
ben / cool-workspace / #8888 (http://test.com/@ben/cool-workspace/builds/88=
|
||||
88)
|
||||
|
||||
We recommend reviewing these issues to ensure future builds are successful.
|
||||
|
||||
|
||||
View workspaces: http://test.com/workspaces?filter=3Dtemplate%3Abobby-first=
|
||||
-template
|
||||
View workspaces: http://test.com/workspaces?filter=3Did%3A24f5bd8f-1566-437=
|
||||
4-9734-c3efa0454dc7+id%3A372a194b-dcde-43f1-b7cf-8a2f3d3114a0+id%3A1386d294=
|
||||
-19c1-4351-89e2-6cae1afb9bfe+id%3A86fd99b1-1b6e-4b7e-b58e-0aee6e35c159+id%3=
|
||||
Acd469690-b6eb-4123-b759-980be7a7b278+id%3Ac447d472-0800-4529-a836-788754d5=
|
||||
e27d+id%3A919db6df-48f0-4dc1-b357-9036a2c40f86+id%3Ac8fb0652-9290-4bf2-a711=
|
||||
-71b910243ac2+id%3A703d718d-2234-4990-9a02-5b1df6cf462a
|
||||
|
||||
--bbe61b741255b6098bb6b3c1f41b885773df633cb18d2a3002b68e4bc9c4
|
||||
Content-Transfer-Encoding: quoted-printable
|
||||
@@ -46,8 +68,7 @@ Content-Type: text/html; charset=UTF-8
|
||||
<meta charset=3D"UTF-8" />
|
||||
<meta name=3D"viewport" content=3D"width=3Ddevice-width, initial-scale=
|
||||
=3D1.0" />
|
||||
<title>Workspace builds failed for template "Bobby First Template"</tit=
|
||||
le>
|
||||
<title>Failed workspace builds report</title>
|
||||
</head>
|
||||
<body style=3D"margin: 0; padding: 0; font-family: -apple-system, system-=
|
||||
ui, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarel=
|
||||
@@ -62,35 +83,73 @@ er Logo" style=3D"height: 40px;" />
|
||||
</div>
|
||||
<h1 style=3D"text-align: center; font-size: 24px; font-weight: 400; m=
|
||||
argin: 8px 0 32px; line-height: 1.5;">
|
||||
Workspace builds failed for template "Bobby First Template"
|
||||
Failed workspace builds report
|
||||
</h1>
|
||||
<div style=3D"line-height: 1.5;">
|
||||
<p>Hi Bobby,</p>
|
||||
<p>Template <strong>Bobby First Template</strong> has failed to bui=
|
||||
ld <sup>4</sup>⁄<sub>55</sub> times over the last week.</p>
|
||||
<p>The following templates have had build failures over the last we=
|
||||
ek:</p>
|
||||
|
||||
<ul>
|
||||
<li><p><strong>Bobby First Template</strong> failed to build <sup>4</sup>&f=
|
||||
rasl;<sub>55</sub> times</p></li>
|
||||
|
||||
<li><p><strong>Bobby Second Template</strong> failed to build <sup>5</sup>&=
|
||||
frasl;<sub>50</sub> times</p></li>
|
||||
</ul>
|
||||
|
||||
<p><strong>Report:</strong></p>
|
||||
|
||||
<p><strong>bobby-template-version-1</strong> failed 3 times:</p>
|
||||
<p><strong>Bobby First Template</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><a href=3D"http://test.com/@mtojek/workspace-1/builds/1234">mtojek / wo=
|
||||
rkspace-1 / #1234</a><br>
|
||||
</li>
|
||||
<li><a href=3D"http://test.com/@johndoe/my-workspace-3/builds/5678">johndoe=
|
||||
/ my-workspace-3 / #5678</a><br>
|
||||
</li>
|
||||
<li><a href=3D"http://test.com/@jack/workwork/builds/774">jack / workwork /=
|
||||
#774</a><br>
|
||||
</li>
|
||||
</ul>
|
||||
<li><p><strong>bobby-template-version-1</strong> failed 3 times:</p>
|
||||
|
||||
<p><strong>bobby-template-version-2</strong> failed 1 time:</p>
|
||||
<ul>
|
||||
<li><p><a href=3D"http://test.com/@mtojek/workspace-1/builds/1234">mtojek /=
|
||||
workspace-1 / #1234</a></p></li>
|
||||
|
||||
<li><p><a href=3D"http://test.com/@johndoe/my-workspace-3/builds/5678">john=
|
||||
doe / my-workspace-3 / #5678</a></p></li>
|
||||
|
||||
<li><p><a href=3D"http://test.com/@jack/workwork/builds/774">jack / workwor=
|
||||
k / #774</a></p></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p><strong>bobby-template-version-2</strong> failed 1 time:</p>
|
||||
|
||||
<ul>
|
||||
<li><a href=3D"http://test.com/@ben/cool-workspace/builds/8888">ben / cool-=
|
||||
workspace / #8888</a><br>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
|
||||
<p><strong>Bobby Second Template</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><p><strong>bobby-template-version-1</strong> failed 3 times:</p>
|
||||
|
||||
<ul>
|
||||
<li><p><a href=3D"http://test.com/@daniellemaywood/workspace-9/builds/9234"=
|
||||
>daniellemaywood / workspace-9 / #9234</a></p></li>
|
||||
|
||||
<li><p><a href=3D"http://test.com/@johndoe/my-workspace-7/builds/8678">john=
|
||||
doe / my-workspace-7 / #8678</a></p></li>
|
||||
|
||||
<li><p><a href=3D"http://test.com/@jack/workworkwork/builds/374">jack / wor=
|
||||
kworkwork / #374</a></p></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p><strong>bobby-template-version-2</strong> failed 2 times:</p>
|
||||
|
||||
<ul>
|
||||
<li><p><a href=3D"http://test.com/@ben/more-cool-workspace/builds/8878">ben=
|
||||
/ more-cool-workspace / #8878</a></p></li>
|
||||
|
||||
<li><p><a href=3D"http://test.com/@ben/less-cool-workspace/builds/8848">ben=
|
||||
/ less-cool-workspace / #8848</a></p></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
|
||||
<p>We recommend reviewing these issues to ensure future builds are successf=
|
||||
@@ -98,10 +157,14 @@ ul.</p>
|
||||
</div>
|
||||
<div style=3D"text-align: center; margin-top: 32px;">
|
||||
=20
|
||||
<a href=3D"http://test.com/workspaces?filter=3Dtemplate%3Abobby-fir=
|
||||
st-template" style=3D"display: inline-block; padding: 13px 24px; background=
|
||||
-color: #020617; color: #f8fafc; text-decoration: none; border-radius: 8px;=
|
||||
margin: 0 4px;">
|
||||
<a href=3D"http://test.com/workspaces?filter=3Did%3A24f5bd8f-1566-4=
|
||||
374-9734-c3efa0454dc7+id%3A372a194b-dcde-43f1-b7cf-8a2f3d3114a0+id%3A1386d2=
|
||||
94-19c1-4351-89e2-6cae1afb9bfe+id%3A86fd99b1-1b6e-4b7e-b58e-0aee6e35c159+id=
|
||||
%3Acd469690-b6eb-4123-b759-980be7a7b278+id%3Ac447d472-0800-4529-a836-788754=
|
||||
d5e27d+id%3A919db6df-48f0-4dc1-b357-9036a2c40f86+id%3Ac8fb0652-9290-4bf2-a7=
|
||||
11-71b910243ac2+id%3A703d718d-2234-4990-9a02-5b1df6cf462a" style=3D"display=
|
||||
: inline-block; padding: 13px 24px; background-color: #020617; color: #f8fa=
|
||||
fc; text-decoration: none; border-radius: 8px; margin: 0 4px;">
|
||||
View workspaces
|
||||
</a>
|
||||
=20
|
||||
|
||||
+93
-36
@@ -3,7 +3,7 @@
|
||||
"msg_id": "00000000-0000-0000-0000-000000000000",
|
||||
"payload": {
|
||||
"_version": "1.2",
|
||||
"notification_name": "Report: Workspace Builds Failed For Template",
|
||||
"notification_name": "Report: Workspace Builds Failed",
|
||||
"notification_template_id": "00000000-0000-0000-0000-000000000000",
|
||||
"user_id": "00000000-0000-0000-0000-000000000000",
|
||||
"user_email": "bobby@coder.com",
|
||||
@@ -12,56 +12,113 @@
|
||||
"actions": [
|
||||
{
|
||||
"label": "View workspaces",
|
||||
"url": "http://test.com/workspaces?filter=template%3Abobby-first-template"
|
||||
"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"
|
||||
}
|
||||
],
|
||||
"labels": {
|
||||
"template_display_name": "Bobby First Template",
|
||||
"template_name": "bobby-first-template"
|
||||
},
|
||||
"labels": {},
|
||||
"data": {
|
||||
"failed_builds": 4,
|
||||
"report_frequency": "week",
|
||||
"template_versions": [
|
||||
"templates": [
|
||||
{
|
||||
"failed_builds": [
|
||||
"display_name": "Bobby First Template",
|
||||
"failed_builds": 4,
|
||||
"name": "bobby-first-template",
|
||||
"total_builds": 55,
|
||||
"versions": [
|
||||
{
|
||||
"build_number": 1234,
|
||||
"workspace_name": "workspace-1",
|
||||
"workspace_owner_username": "mtojek"
|
||||
"failed_builds": [
|
||||
{
|
||||
"build_number": 1234,
|
||||
"workspace_id": "00000000-0000-0000-0000-000000000000",
|
||||
"workspace_name": "workspace-1",
|
||||
"workspace_owner_username": "mtojek"
|
||||
},
|
||||
{
|
||||
"build_number": 5678,
|
||||
"workspace_id": "00000000-0000-0000-0000-000000000000",
|
||||
"workspace_name": "my-workspace-3",
|
||||
"workspace_owner_username": "johndoe"
|
||||
},
|
||||
{
|
||||
"build_number": 774,
|
||||
"workspace_id": "00000000-0000-0000-0000-000000000000",
|
||||
"workspace_name": "workwork",
|
||||
"workspace_owner_username": "jack"
|
||||
}
|
||||
],
|
||||
"failed_count": 3,
|
||||
"template_version_name": "bobby-template-version-1"
|
||||
},
|
||||
{
|
||||
"build_number": 5678,
|
||||
"workspace_name": "my-workspace-3",
|
||||
"workspace_owner_username": "johndoe"
|
||||
},
|
||||
{
|
||||
"build_number": 774,
|
||||
"workspace_name": "workwork",
|
||||
"workspace_owner_username": "jack"
|
||||
"failed_builds": [
|
||||
{
|
||||
"build_number": 8888,
|
||||
"workspace_id": "00000000-0000-0000-0000-000000000000",
|
||||
"workspace_name": "cool-workspace",
|
||||
"workspace_owner_username": "ben"
|
||||
}
|
||||
],
|
||||
"failed_count": 1,
|
||||
"template_version_name": "bobby-template-version-2"
|
||||
}
|
||||
],
|
||||
"failed_count": 3,
|
||||
"template_version_name": "bobby-template-version-1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"failed_builds": [
|
||||
"display_name": "Bobby Second Template",
|
||||
"failed_builds": 5,
|
||||
"name": "bobby-second-template",
|
||||
"total_builds": 50,
|
||||
"versions": [
|
||||
{
|
||||
"build_number": 8888,
|
||||
"workspace_name": "cool-workspace",
|
||||
"workspace_owner_username": "ben"
|
||||
"failed_builds": [
|
||||
{
|
||||
"build_number": 9234,
|
||||
"workspace_id": "00000000-0000-0000-0000-000000000000",
|
||||
"workspace_name": "workspace-9",
|
||||
"workspace_owner_username": "daniellemaywood"
|
||||
},
|
||||
{
|
||||
"build_number": 8678,
|
||||
"workspace_id": "00000000-0000-0000-0000-000000000000",
|
||||
"workspace_name": "my-workspace-7",
|
||||
"workspace_owner_username": "johndoe"
|
||||
},
|
||||
{
|
||||
"build_number": 374,
|
||||
"workspace_id": "00000000-0000-0000-0000-000000000000",
|
||||
"workspace_name": "workworkwork",
|
||||
"workspace_owner_username": "jack"
|
||||
}
|
||||
],
|
||||
"failed_count": 3,
|
||||
"template_version_name": "bobby-template-version-1"
|
||||
},
|
||||
{
|
||||
"failed_builds": [
|
||||
{
|
||||
"build_number": 8878,
|
||||
"workspace_id": "00000000-0000-0000-0000-000000000000",
|
||||
"workspace_name": "more-cool-workspace",
|
||||
"workspace_owner_username": "ben"
|
||||
},
|
||||
{
|
||||
"build_number": 8848,
|
||||
"workspace_id": "00000000-0000-0000-0000-000000000000",
|
||||
"workspace_name": "less-cool-workspace",
|
||||
"workspace_owner_username": "ben"
|
||||
}
|
||||
],
|
||||
"failed_count": 2,
|
||||
"template_version_name": "bobby-template-version-2"
|
||||
}
|
||||
],
|
||||
"failed_count": 1,
|
||||
"template_version_name": "bobby-template-version-2"
|
||||
]
|
||||
}
|
||||
],
|
||||
"total_builds": 55
|
||||
]
|
||||
},
|
||||
"targets": null
|
||||
},
|
||||
"title": "Workspace builds failed for template \"Bobby First Template\"",
|
||||
"title_markdown": "Workspace builds failed for template \"Bobby First Template\"",
|
||||
"body": "Template Bobby First Template has failed to build 4/55 times over the last week.\n\nReport:\n\nbobby-template-version-1 failed 3 times:\n\nmtojek / workspace-1 / #1234 (http://test.com/@mtojek/workspace-1/builds/1234)\njohndoe / my-workspace-3 / #5678 (http://test.com/@johndoe/my-workspace-3/builds/5678)\njack / workwork / #774 (http://test.com/@jack/workwork/builds/774)\n\nbobby-template-version-2 failed 1 time:\n\nben / cool-workspace / #8888 (http://test.com/@ben/cool-workspace/builds/8888)\n\nWe recommend reviewing these issues to ensure future builds are successful.",
|
||||
"body_markdown": "Template **Bobby First Template** has failed to build 4/55 times over the last week.\n\n**Report:**\n\n**bobby-template-version-1** failed 3 times:\n\n* [mtojek / workspace-1 / #1234](http://test.com/@mtojek/workspace-1/builds/1234)\n* [johndoe / my-workspace-3 / #5678](http://test.com/@johndoe/my-workspace-3/builds/5678)\n* [jack / workwork / #774](http://test.com/@jack/workwork/builds/774)\n\n**bobby-template-version-2** failed 1 time:\n\n* [ben / cool-workspace / #8888](http://test.com/@ben/cool-workspace/builds/8888)\n\nWe recommend reviewing these issues to ensure future builds are successful."
|
||||
"title": "Failed workspace builds report",
|
||||
"title_markdown": "Failed workspace builds report",
|
||||
"body": "The following templates have had build failures over the last week:\n\nBobby First Template failed to build 4/55 times\nBobby Second Template failed to build 5/50 times\n\nReport:\n\nBobby First Template\n\nbobby-template-version-1 failed 3 times:\n mtojek / workspace-1 / #1234 (http://test.com/@mtojek/workspace-1/builds/1234)\n johndoe / my-workspace-3 / #5678 (http://test.com/@johndoe/my-workspace-3/builds/5678)\n jack / workwork / #774 (http://test.com/@jack/workwork/builds/774)\nbobby-template-version-2 failed 1 time:\n ben / cool-workspace / #8888 (http://test.com/@ben/cool-workspace/builds/8888)\n\n\nBobby Second Template\n\nbobby-template-version-1 failed 3 times:\n daniellemaywood / workspace-9 / #9234 (http://test.com/@daniellemaywood/workspace-9/builds/9234)\n johndoe / my-workspace-7 / #8678 (http://test.com/@johndoe/my-workspace-7/builds/8678)\n jack / workworkwork / #374 (http://test.com/@jack/workworkwork/builds/374)\nbobby-template-version-2 failed 2 times:\n ben / more-cool-workspace / #8878 (http://test.com/@ben/more-cool-workspace/builds/8878)\n ben / less-cool-workspace / #8848 (http://test.com/@ben/less-cool-workspace/builds/8848)\n\n\nWe recommend reviewing these issues to ensure future builds are successful.",
|
||||
"body_markdown": "The following templates have had build failures over the last week:\n\n- **Bobby First Template** failed to build 4/55 times\n\n- **Bobby Second Template** failed to build 5/50 times\n\n\n**Report:**\n\n**Bobby First Template**\n\n- **bobby-template-version-1** failed 3 times:\n\n - [mtojek / workspace-1 / #1234](http://test.com/@mtojek/workspace-1/builds/1234)\n\n - [johndoe / my-workspace-3 / #5678](http://test.com/@johndoe/my-workspace-3/builds/5678)\n\n - [jack / workwork / #774](http://test.com/@jack/workwork/builds/774)\n\n\n- **bobby-template-version-2** failed 1 time:\n\n - [ben / cool-workspace / #8888](http://test.com/@ben/cool-workspace/builds/8888)\n\n\n\n**Bobby Second Template**\n\n- **bobby-template-version-1** failed 3 times:\n\n - [daniellemaywood / workspace-9 / #9234](http://test.com/@daniellemaywood/workspace-9/builds/9234)\n\n - [johndoe / my-workspace-7 / #8678](http://test.com/@johndoe/my-workspace-7/builds/8678)\n\n - [jack / workworkwork / #374](http://test.com/@jack/workworkwork/builds/374)\n\n\n- **bobby-template-version-2** failed 2 times:\n\n - [ben / more-cool-workspace / #8878](http://test.com/@ben/more-cool-workspace/builds/8878)\n\n - [ben / less-cool-workspace / #8848](http://test.com/@ben/less-cool-workspace/builds/8848)\n\n\n\n\nWe recommend reviewing these issues to ensure future builds are successful."
|
||||
}
|
||||
Reference in New Issue
Block a user