Skip to content

feat: notify owner about failed autobuild #13891

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 13 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix: build reason
  • Loading branch information
mtojek committed Jul 15, 2024
commit e6a5aef55cbd2a85d32b6593e5752f9984cb3e7c
2 changes: 1 addition & 1 deletion coderd/provisionerdserver/provisionerdserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@ func (s *server) notifyWorkspaceBuildFailed(ctx context.Context, workspace datab
if build.Reason.Valid() && build.Reason == database.BuildReasonInitiator {
return // failed workspace build initiated by a user should not notify
}
reason = "initiated by autobuild"
reason = string(build.Reason)
initiator := "autobuild"

if _, err := s.NotificationEnqueuer.Enqueue(ctx, workspace.OwnerID, notifications.WorkspaceAutobuildFailed,
Expand Down
6 changes: 2 additions & 4 deletions coderd/provisionerdserver/provisionerdserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1702,9 +1702,8 @@ func TestNotifications(t *testing.T) {
tests := []struct {
name string

buildReason database.BuildReason
shouldNotify bool
shouldDeleteWorkspace bool
buildReason database.BuildReason
shouldNotify bool
}{
{
name: "initiated by owner",
Expand Down Expand Up @@ -1793,7 +1792,6 @@ func TestNotifications(t *testing.T) {

workspace, err = db.GetWorkspaceByID(ctx, workspace.ID)
require.NoError(t, err)
require.Equal(t, tc.shouldDeleteWorkspace, workspace.Deleted)

if tc.shouldNotify {
// Validate that the notification was sent and contained the expected values.
Expand Down
Loading