Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mtojek merged 13 commits intomainfrom7-autobuild-failure
Jul 16, 2024
Merged
Changes from1 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
PrevPrevious commit
NextNext commit
fix: initiator
  • Loading branch information
@mtojek
mtojek committedJul 15, 2024
commit881dc5e7ff8c6b72003fd91fc9aeb1ab153f29b4
17 changes: 12 additions & 5 deletionscoderd/provisionerdserver/provisionerdserver.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1549,6 +1549,7 @@ func (s *server) CompleteJob(ctx context.Context, completed *proto.CompletedJob)

func (s *server) notifyWorkspaceDeleted(ctx context.Context, workspace database.Workspace, build database.WorkspaceBuild) {
var reason string
initiator := build.InitiatorByUsername
if build.Reason.Valid() {
switch build.Reason {
case database.BuildReasonInitiator:
Expand All@@ -1560,6 +1561,7 @@ func (s *server) notifyWorkspaceDeleted(ctx context.Context, workspace database.
reason = "initiated by user"
case database.BuildReasonAutodelete:
reason = "autodeleted due to dormancy"
initiator = ""
default:
reason = string(build.Reason)
}
Expand All@@ -1569,12 +1571,17 @@ func (s *server) notifyWorkspaceDeleted(ctx context.Context, workspace database.
slog.F("reason", reason), slog.F("workspace_id", workspace.ID), slog.F("build_id", build.ID))
}

labels := map[string]string{
"name": workspace.Name,
"reason": reason,
}

if initiator != "" {
labels["initiator"] = initiator
}

if _, err := s.NotificationEnqueuer.Enqueue(ctx, workspace.OwnerID, notifications.TemplateWorkspaceDeleted,
map[string]string{
"name": workspace.Name,
"initiator": build.InitiatorByUsername,
"reason": reason,
}, "provisionerdserver",
labels, "provisionerdserver",
// Associate this notification with all the related entities.
workspace.ID, workspace.OwnerID, workspace.TemplateID, workspace.OrganizationID,
); err != nil {
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp