Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Bartlomiej Plotka <[email protected]>
Signed-off-by: Jason Wells <[email protected]>
  • Loading branch information
twotired and bwplotka authored Jan 30, 2024
1 parent 7575a22 commit 98f8308
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion examples/jiralert.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ defaults:
reopen_duration: 0h
# Static label that will be added to the JIRA ticket alongisde the JIRALERT{...} or ALERT{...} label
static_labels: ["custom"]
# Other projects that issues may be moved to and further updates are desired
# Other projects are the projects to search for existing issues for the given alerts if
# the main project does not have it. If no issue was found in, the main projects will
# be used to create a new one. If the old issue is found in one of the other projects
# (first found is used in case of duplicates) that old project's issue will be used for
# alert updates instead of creating on in the main project.
other_projects: ["OTHER1", "OTHER2"]

# Receiver definitions. At least one must be defined.
Expand Down
4 changes: 2 additions & 2 deletions pkg/notify/notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ func toGroupTicketLabel(groupLabels alertmanager.KV, hashJiraLabel bool) string
}

func (r *Receiver) search(projects []string, issueLabel string) (*jira.Issue, bool, error) {
// search multiple projects in case issue was moved and further alert firings are desired in existing JIRA
// Search multiple projects in case issue was moved and further alert firings are desired in existing JIRA.
projectList := "'" + strings.Join(projects, "', '") + "'"
query := fmt.Sprintf("project in(%s) and labels=%q order by resolutiondate desc", projectList, issueLabel)
options := &jira.SearchOptions{
Expand Down Expand Up @@ -320,7 +320,7 @@ func (r *Receiver) search(projects []string, issueLabel string) (*jira.Issue, bo

func (r *Receiver) findIssueToReuse(project string, issueGroupLabel string) (*jira.Issue, bool, error) {
projectsToSearch := []string{project}
// in case issue was moved to a different project, include configured potential other projects in search
// In case issue was moved to a different project, include the other configured projects in search (if any).
for _, other := range r.conf.OtherProjects {
if other != project {
projectsToSearch = append(projectsToSearch, other)
Expand Down

0 comments on commit 98f8308

Please sign in to comment.