Allow issue updates to update incident escalation status
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, settingstatus
andpolicy
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.
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.
- Enable the feature flag
Feature.enable(:incident_escalations)
- 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
- Run
::Issues::UpdateService.new(project: project, current_user: user, params: { escalation_status: { status: :resolved } }).execute(incident)
- See updated record with
incident.escalation_status
- To test with an escalation policy, create a policy
policy = project.incident_management_escalation_policies.first
- 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
- The incident used here should not have an associated
- 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.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Peter Leitzen