Skip to content

Commit

Permalink
fix: issue resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
alikhil committed Nov 30, 2022
1 parent 0241111 commit 0a9a958
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions pkg/notify/notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,12 @@ func (r *Receiver) Notify(data *alertmanager.Data, hashJiraLabel bool) (bool, er
return false, nil
}

level.Info(r.logger).Log("msg", "issue was recently resolved, reopening", "key", issue.Key, "label", issueGroupLabel)
return r.reopen(issue.Key)
if r.conf.ReopenEnabled != nil && !*r.conf.ReopenEnabled {
level.Debug(r.logger).Log("msg", "reopening disabled, skipping search for existing issue")
} else {
level.Info(r.logger).Log("msg", "issue was recently resolved, reopening", "key", issue.Key, "label", issueGroupLabel)
return r.reopen(issue.Key)
}
}

if len(data.Alerts.Firing()) == 0 {
Expand Down Expand Up @@ -301,11 +305,6 @@ func (r *Receiver) search(project, issueLabel string) (*jira.Issue, bool, error)

func (r *Receiver) findIssueToReuse(project string, issueGroupLabel string) (*jira.Issue, bool, error) {

if r.conf.ReopenEnabled != nil && !*r.conf.ReopenEnabled {
level.Debug(r.logger).Log("msg", "reopening disabled, skipping search for existing issue")
return nil, false, nil
}

issue, retry, err := r.search(project, issueGroupLabel)
if err != nil {
return nil, retry, err
Expand Down

0 comments on commit 0a9a958

Please sign in to comment.