Skip to content

Allow issue updates to update incident escalation status

Sarah Yasonik requested to merge sy-add-escalation-status-to-issue-updates into master

What does this MR do and why?

Related issues: #330284 (closed), #330283 (closed)

This MR:

  • Adds support for updating incidents with existing IncidentManagement::IssuableEscalationStatus records, setting status and policy values
  • Syncs the status of the incident back to any associated alerts on the incident

Out of scope (for future MRs):

  • Creating IncidentManagement::PendingEscalations::Issue records
  • Triggering issue webhooks
  • Exposing attributes in GraphQL

Overall flow:

There will be a number of steps to updates to IncidentManagement::IssuableEscalationStatus records. These steps roughly follow the flowchart below. The area circled in red is the scope of this MR.

Screen_Shot_2021-12-14_at_7.32.18_PM

How to set up and validate locally

Testing is done via rails console for this MR, as none of this is yet accessible to users.

  1. Enable the feature flag
    Feature.enable(:incident_escalations)
  2. Create an incident via UI (Issue w/ issue_type of :incident; an IncidentManagement::IssuableEscalationStatus record should be created automatically)
    incident = Issue.where(issue_type: 1).last # you can do w/ or without an alert and get different behavior
    project = incident.project
    user = project.owner # or whatever user has developer+ permissions on the project
  3. Run ::Issues::UpdateService.new(project: project, current_user: user, params: { escalation_status: { status: :resolved } }).execute(incident)
  4. See updated record with incident.escalation_status
  5. To test with an escalation policy, create a policy
    policy = project.incident_management_escalation_policies.first
  6. Run ::Issues::UpdateService.new(project: project, current_user: user, params: { escalation_status: { policy: policy } }).execute(incident)
    • The incident used here should not have an associated AlertManagement::Alert if you want the policy/escalations_started_at value to be set
  7. See updated record with incident.escalation_status

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Peter Leitzen

Merge request reports

Loading