MCPcopy Create free account
hub / github.com/bytebase/bytebase / autoResolveIssue

Method autoResolveIssue

backend/runner/taskrun/scheduler.go:284–302  ·  view source on GitHub ↗

autoResolveIssue automatically resolves the issue associated with a plan by setting its status to DONE.

(ctx context.Context, projectID string, planID int64)

Source from the content-addressed store, hash-verified

282
283// autoResolveIssue automatically resolves the issue associated with a plan by setting its status to DONE.
284func (s *Scheduler) autoResolveIssue(ctx context.Context, projectID string, planID int64) {
285 issue, err := s.store.GetIssue(ctx, &store.FindIssueMessage{ProjectIDs: []string{projectID}, PlanUID: &planID})
286 if err != nil {
287 slog.Error("failed to get issue for auto-resolve", log.BBError(err))
288 return
289 }
290 if issue == nil {
291 return
292 }
293 if issue.Status != storepb.Issue_OPEN {
294 return
295 }
296
297 if _, err := s.store.UpdateIssue(ctx, issue.ProjectID, issue.UID, &store.UpdateIssueMessage{Status: new(storepb.Issue_DONE)}); err != nil {
298 slog.Error("failed to auto-resolve issue", slog.String("project", projectID), slog.Int64("issueUID", issue.UID), log.BBError(err))
299 return
300 }
301 slog.Info("auto-resolved deferred rollout issue", slog.String("project", projectID), slog.Int64("issueUID", issue.UID), slog.Int64("planID", planID))
302}

Callers 1

checkPlanCompletionMethod · 0.95

Calls 6

BBErrorFunction · 0.92
InfoMethod · 0.80
GetIssueMethod · 0.65
UpdateIssueMethod · 0.65
StringMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected