Add escalation-related attributes to issue webhook
What does this MR do and why?
- Related issue: #330284 (closed) (webhook details)
- Docs changes: !80441 (merged)
This MR adds support for escalation_status
and escalation_policy
attributes to the issue webhook payload.
Both fields correspond to incident-only features, so they'll only appear in the webhook payload for incidents. escalation_policy
is only available for GitLab Premium, so the field will only appear correspondingly.
As this is still behind the incident_escalations
feature flag, I've opted to exclude a changelog. If the incident_escalations
flag is rolled out before this merges, I'll add the changelog trailers then.
Relevant sample hook output
Updating status | Updating policy | Updating status & policy | Updating unrelated field (milestone) |
---|---|---|---|
How to set up and validate locally
- Enable the feature flag
Feature.enable(:incident_escalations)
- Create or navigate to a GitLab Premium project
- Create a new incident (
New Issue w/ type=Incident
||Monitor > Incidents
) - If not yet created, create an escalation policy under
Monitor > Escalation Policies
(any rules are fine) - Setup a webhook which pushes Issues events at
Settings > Webhooks
- Possible pre-req: Setup a webhook receiver to view output (I can't remember if this is required for initial setup...)
- Navigate to the
Edit
page of the hook to view hook output
- Update the status of the incident in the rails console (dropdown coming in !66165 (merged)) & view the hook output
project = Project.find(<PROJECT_ID>) incident = project.issues.last ::Issues::UpdateService.new(project: project, current_user: User.first, params: { escalation_status: { status: :acknowledged } }).execute(incident)
-
escalation_status
should be an attribute in the body with value ofAcknowledged
-
escalation_policy
should be an attribute in the body with value ofnil
-
escalation_status
should be present in thechanges
section of the payload
-
- Update the policy of the incident in the rails console (dropdown coming in !66165 (merged)) & view the hook output
project = Project.find(<PROJECT_ID>) incident = project.issues.last policy = project.incident_management_escalation_policies.last ::Issues::UpdateService.new(project: project, current_user: User.first, params: { escalation_status: { policy: policy } }).execute(incident)
-
escalation_status
should be an attribute in the body with value ofTriggered
(setting a policy re-triggers an incident) -
escalation_policy
should be an attribute in the body with value of{ id: <ID>, name: <name> }
-
escalation_status
&escalation_policy
should both be present in thechanges
section of the payload
-
- Unset the policy & view the hook output
project = Project.find(<PROJECT_ID>) incident = project.issues.last ::Issues::UpdateService.new(project: project, current_user: User.first, params: { escalation_status: { policy: nil } }).execute(incident)
- only
escalation_policy
should be present in thechanges
section of the payload
- only
- Change some other attribute via the UI to see a payload without escalation fields
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