Skip to content

revert: "feat(coderd/notifications): group workspace build failure report (cherry-pick #17306)" #17540

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
merged 1 commit into from
Apr 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 0 additions & 1 deletion coderd/database/dbmem/dbmem.go
Original file line number Diff line number Diff line change
Expand Up @@ -3283,7 +3283,6 @@ func (q *FakeQuerier) GetFailedWorkspaceBuildsByTemplateID(ctx context.Context,
}

workspaceBuildStats = append(workspaceBuildStats, database.GetFailedWorkspaceBuildsByTemplateIDRow{
WorkspaceID: w.ID,
WorkspaceName: w.Name,
WorkspaceOwnerUsername: workspaceOwner.Username,
TemplateVersionName: templateVersion.Name,
Expand Down

This file was deleted.

This file was deleted.

11 changes: 4 additions & 7 deletions coderd/database/queries.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion coderd/database/queries/workspacebuilds.sql
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ SELECT
tv.name AS template_version_name,
u.username AS workspace_owner_username,
w.name AS workspace_name,
w.id AS workspace_id,
wb.build_number AS workspace_build_number
FROM
workspace_build_with_user AS wb
Expand Down
111 changes: 27 additions & 84 deletions coderd/notifications/notifications_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -978,102 +978,45 @@ func TestNotificationTemplates_Golden(t *testing.T) {
UserName: "Bobby",
UserEmail: "bobby@coder.com",
UserUsername: "bobby",
Labels: map[string]string{},
Labels: map[string]string{
"template_name": "bobby-first-template",
"template_display_name": "Bobby First Template",
},
// We need to use floats as `json.Unmarshal` unmarshal numbers in `map[string]any` to floats.
Data: map[string]any{
"failed_builds": 4.0,
"total_builds": 55.0,
"report_frequency": "week",
"templates": []map[string]any{
"template_versions": []map[string]any{
{
"name": "bobby-first-template",
"display_name": "Bobby First Template",
"failed_builds": 4.0,
"total_builds": 55.0,
"versions": []map[string]any{
"template_version_name": "bobby-template-version-1",
"failed_count": 3.0,
"failed_builds": []map[string]any{
{
"template_version_name": "bobby-template-version-1",
"failed_count": 3.0,
"failed_builds": []map[string]any{
{
"workspace_owner_username": "mtojek",
"workspace_name": "workspace-1",
"workspace_id": "24f5bd8f-1566-4374-9734-c3efa0454dc7",
"build_number": 1234.0,
},
{
"workspace_owner_username": "johndoe",
"workspace_name": "my-workspace-3",
"workspace_id": "372a194b-dcde-43f1-b7cf-8a2f3d3114a0",
"build_number": 5678.0,
},
{
"workspace_owner_username": "jack",
"workspace_name": "workwork",
"workspace_id": "1386d294-19c1-4351-89e2-6cae1afb9bfe",
"build_number": 774.0,
},
},
"workspace_owner_username": "mtojek",
"workspace_name": "workspace-1",
"build_number": 1234.0,
},
{
"template_version_name": "bobby-template-version-2",
"failed_count": 1.0,
"failed_builds": []map[string]any{
{
"workspace_owner_username": "ben",
"workspace_name": "cool-workspace",
"workspace_id": "86fd99b1-1b6e-4b7e-b58e-0aee6e35c159",
"build_number": 8888.0,
},
},
"workspace_owner_username": "johndoe",
"workspace_name": "my-workspace-3",
"build_number": 5678.0,
},
{
"workspace_owner_username": "jack",
"workspace_name": "workwork",
"build_number": 774.0,
},
},
},
{
"name": "bobby-second-template",
"display_name": "Bobby Second Template",
"failed_builds": 5.0,
"total_builds": 50.0,
"versions": []map[string]any{
{
"template_version_name": "bobby-template-version-1",
"failed_count": 3.0,
"failed_builds": []map[string]any{
{
"workspace_owner_username": "daniellemaywood",
"workspace_name": "workspace-9",
"workspace_id": "cd469690-b6eb-4123-b759-980be7a7b278",
"build_number": 9234.0,
},
{
"workspace_owner_username": "johndoe",
"workspace_name": "my-workspace-7",
"workspace_id": "c447d472-0800-4529-a836-788754d5e27d",
"build_number": 8678.0,
},
{
"workspace_owner_username": "jack",
"workspace_name": "workworkwork",
"workspace_id": "919db6df-48f0-4dc1-b357-9036a2c40f86",
"build_number": 374.0,
},
},
},
"template_version_name": "bobby-template-version-2",
"failed_count": 1.0,
"failed_builds": []map[string]any{
{
"template_version_name": "bobby-template-version-2",
"failed_count": 2.0,
"failed_builds": []map[string]any{
{
"workspace_owner_username": "ben",
"workspace_name": "more-cool-workspace",
"workspace_id": "c8fb0652-9290-4bf2-a711-71b910243ac2",
"build_number": 8878.0,
},
{
"workspace_owner_username": "ben",
"workspace_name": "less-cool-workspace",
"workspace_id": "703d718d-2234-4990-9a02-5b1df6cf462a",
"build_number": 8848.0,
},
},
"workspace_owner_username": "ben",
"workspace_name": "cool-workspace",
"build_number": 8888.0,
},
},
},
Expand Down
Loading
Loading