Skip to content

Fix multiple issue creation for Generic Alerts

What does this MR do?

In !29941 (merged) we've extended IncidentManagement::ProcessAlertWorker to link the created issue to the created alert.

The code assumed that IncidentManagement::CreateIssueService returned the issue instance but it returns a Hash. Sadly, this was not caught by the specs because they used an instance_double which also returned the issue directly rather than the Hash.

On GitLab.com this bug resulted a sidekiq job error undefined method 'persisted?' for #<Hash:0x00007f0bc5c901d0> (see #220088 (comment 353968201)), so the job got retried which created multiple issues with the same alert payload without linking the alert to the created issue.

This MR fixes the bug and removes the instance_double to make the specs a little more robust.

Attempts to fix #220088 (closed).

Screenshots

Only a single issue (Fixed issue) is created and the Alert is linked properly (see View Issue and Issue Iid) to the created issue.

Issue list Alerts details
Screenshot_from_2020-06-02_22-56-47 Screenshot_from_2020-06-02_22-56-17

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team
Edited by Peter Leitzen

Merge request reports

Loading