Add mutation for setting escalation policy on incidents
What does this MR do and why?
- Related issues: #330284 (closed), #332065 (closed)
- Dependent on: !76819 (merged)
This MR:
- Creates pending escalations for incidents when relevant policy or status updates occur
- Moves helpers for "open" statuses from
AlertManagement::Alert
intoEscalatable
module - Adds sidekiq processing for issue escalations following same flow as for
PendingEscalation::Alert
Overall flow:
There are 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.
Sample inputs/outputs
Fetch
query issues {
project(fullPath: "root/autodevops") {
issues(types: INCIDENT) {
nodes {
iid
title
type
escalationPolicy {
id
name
}
}
}
}
}
{
"data": {
"project": {
"issues": {
"nodes": [
{
"iid": "194",
"title": "trying again on new alert - queue another",
"type": "INCIDENT",
"escalationPolicy": {
"id": "gid://gitlab/IncidentManagement::EscalationPolicy/220",
"name": "Testing"
}
},
{
"iid": "193",
"title": "trying again on new alert - queue another",
"type": "INCIDENT",
"escalationPolicy": null
},
{
"iid": "192",
"title": "trying again on new alert - queue another",
"type": "INCIDENT",
"escalationPolicy": null
}
]
}
}
}
}
Update
mutation SetEscalationPolicy($update: IssueSetEscalationPolicyInput!) {
issueSetEscalationPolicy(input: $update) {
issue {
iid
title
type
escalationPolicy {
id
name
}
}
}
}
Unsetting the policy
{
"update": {
"projectPath": "root/autodevops",
"iid": "194",
"escalationPolicyId": null
}
}
{
"data": {
"issueSetEscalationPolicy": {
"issue": {
"iid": "194",
"title": "trying again on new alert - queue another",
"type": "INCIDENT",
"escalationPolicy": null
}
}
}
}
Setting the policy
{
"update": {
"projectPath": "root/autodevops",
"iid": "194",
"escalationPolicyId": "gid://gitlab/IncidentManagement::EscalationPolicy/220"
}
}
{
"data": {
"issueSetEscalationPolicy": {
"issue": {
"iid": "194",
"title": "trying again on new alert - queue another",
"type": "INCIDENT",
"escalationPolicy": {
"id": "gid://gitlab/IncidentManagement::EscalationPolicy/220",
"name": "Testing"
}
}
}
}
}
How to set up and validate locally
- Follow the steps in !76819 (merged) add an
IncidentManagement::IssuableEscalationStatus
association to your incident - Open
/-/graphql-explorer
in your local env to run graphql queries/mutations like the samples above
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 Sarah Yasonik