Skip to content
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

Change transition order #131

Conversation

fhielpos
Copy link

Hello there,

We have noticed that Jira blocks the Edit action in certain states, causing the integration to fail if these issues aren't transitioned before trying to update the description.

This PR changes the order of operations to avoid updating issues before setting them to the desired state.

Cheers

Comment on lines +117 to +122
// Issue is set as won't fix. Discard.
if r.conf.WontFixResolution != "" && issue.Fields.Resolution != nil &&
issue.Fields.Resolution.Name == r.conf.WontFixResolution {
level.Info(r.logger).Log("msg", "issue was resolved as won't fix, not reopening", "key", issue.Key, "label", issueGroupLabel, "resolution", issue.Fields.Resolution.Name)
return false, nil
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this go at the very top? I.e. before the summary and/or description are updated?

Comment on lines +97 to +98
// Issue is not dynamically updated, so we need to modify the Resolution to avoid creating duplicates on a "won't fix" situation
issue.Fields.Resolution = nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand this.

@@ -115,19 +137,11 @@ func (r *Receiver) Notify(data *alertmanager.Data, hashJiraLabel bool) (bool, er
}

// The set of JIRA status categories is fixed, this is a safe check to make.
if issue.Fields.Status.StatusCategory.Key != "done" {
if issue.Fields.Resolution == nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this either.

Since the issue is about Jira not allowing editing issues in certain states (which presumably covers the summary and description), shouldn't the fix be to just move updating of the summary and description after the r.reopen()?

As is, the code first tries to reopen the issue (and edit it). Then it checks whether it should be reopened. Then resolves it, if no alerts are firing. Finally, if it has just reopened the issue, it logs "issue is unresolved" and exits. Seems kind of random.

@fhielpos fhielpos closed this Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants