-
Notifications
You must be signed in to change notification settings - Fork 914
feat(coderd/notifications): group workspace build failure report #17306
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
DanielleMaywood
merged 8 commits into
main
from
dm-group-build-failures-into-single-report
Apr 10, 2025
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3a2ebee
feat(notifications): group workspace build failure report
DanielleMaywood 18a9a2e
chore: fix broken test, update template
DanielleMaywood c84aaee
chore: update call to action
DanielleMaywood 16af318
chore: oops
DanielleMaywood 382e689
test: workspace ID is present in builds
DanielleMaywood 3ab9253
chore: dbmem, need I say more?
DanielleMaywood 6ab4678
chore: nit
DanielleMaywood 962470b
chore: huh
DanielleMaywood File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
coderd/database/migrations/000316_group_build_failure_notifications.down.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
UPDATE notification_templates | ||
SET | ||
name = 'Report: Workspace Builds Failed For Template', | ||
title_template = E'Workspace builds failed for template "{{.Labels.template_display_name}}"', | ||
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}}. | ||
|
||
**Report:** | ||
{{range $version := .Data.template_versions}} | ||
**{{$version.template_version_name}}** failed {{$version.failed_count}} time{{if gt $version.failed_count 1.0}}s{{end}}: | ||
{{range $build := $version.failed_builds}} | ||
* [{{$build.workspace_owner_username}} / {{$build.workspace_name}} / #{{$build.build_number}}]({{base_url}}/@{{$build.workspace_owner_username}}/{{$build.workspace_name}}/builds/{{$build.build_number}}) | ||
{{- end}} | ||
{{end}} | ||
We recommend reviewing these issues to ensure future builds are successful.', | ||
actions = '[ | ||
{ | ||
"label": "View workspaces", | ||
"url": "{{ base_url }}/workspaces?filter=template%3A{{.Labels.template_name}}" | ||
} | ||
]'::jsonb | ||
WHERE id = '34a20db2-e9cc-4a93-b0e4-8569699d7a00'; |
29 changes: 29 additions & 0 deletions
29
coderd/database/migrations/000316_group_build_failure_notifications.up.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
UPDATE notification_templates | ||
SET | ||
name = 'Report: Workspace Builds Failed', | ||
title_template = 'Failed workspace builds report', | ||
body_template = | ||
E'The following templates have had build failures over the last {{.Data.report_frequency}}: | ||
{{range $template := .Data.templates}} | ||
- **{{$template.display_name}}** failed to build {{$template.failed_builds}}/{{$template.total_builds}} times | ||
DanielleMaywood marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{{end}} | ||
|
||
**Report:** | ||
{{range $template := .Data.templates}} | ||
**{{$template.display_name}}** | ||
{{range $version := $template.versions}} | ||
- **{{$version.template_version_name}}** failed {{$version.failed_count}} time{{if gt $version.failed_count 1.0}}s{{end}}: | ||
{{range $build := $version.failed_builds}} | ||
- [{{$build.workspace_owner_username}} / {{$build.workspace_name}} / #{{$build.build_number}}]({{base_url}}/@{{$build.workspace_owner_username}}/{{$build.workspace_name}}/builds/{{$build.build_number}}) | ||
{{end}} | ||
{{end}} | ||
{{end}} | ||
|
||
We recommend reviewing these issues to ensure future builds are successful.', | ||
actions = '[ | ||
{ | ||
"label": "View workspaces", | ||
"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}}" | ||
DanielleMaywood marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
]'::jsonb | ||
WHERE id = '34a20db2-e9cc-4a93-b0e4-8569699d7a00'; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.