Skip to content

GraphQL mutation for creating Escalation Policies

What does this MR do?

Adds a mutation for creating escalation polcies.

Mutation GraphQL Query / Response

Request w/ input:

mutation CreateEscalationPolicy($input: EscalationPolicyCreateInput!) {
  escalationPolicyCreate(input: $input) {
    escalationPolicy {
      id
      name
      description
      rules {
        status
        elapsedTimeSeconds
        oncallSchedule {
          name
        }
      }
    }
    errors
  }
}


{
  "input": {
    "projectPath": "root/autodevops-deploy-test",
    "name": "Test Escalation Policy 3",
    "description":"Test description",
    "rules": [
      {
        "oncallScheduleIid": "12",
        "elapsedTimeSeconds": 60,
        "status": "ACKNOWLEDGED"
      }

    ]
  }

Response:


{
  "data": {
    "escalationPolicyCreate": {
      "escalationPolicy": {
        "id": "gid://gitlab/IncidentManagement::EscalationPolicy/5",
        "name": "Test Escalation Policy 3",
        "description": "Test description",
        "rules": [
          {
            "status": "ACKNOWLEDGED",
            "elapsedTimeSeconds": 60,
            "oncallSchedule": {
              "name": "schedule"
            }
          }
        ]
      },
      "errors": []
    }
  }
}

Background

This is part of the Escalation Policies MVC, the technical planning of which can be found here.

To achieve this, this work is being broken up into multiple MRs:

  • Add the Escalation policy/rule tables | !60685 (merged)
  • Backfilling the Escalation policies/rules for existing Oncall Schedules | !62233 (merged)
  • Create GraphQl types for Escalation policy/rules | !61439 (merged)
  • Create the Escalation policies via the UI | Frontend MR | Backend MR - THIS MR
  • Add an Escalation model which represents an Escalation, and the services needed for business logic around that (Escalating, sending emails etc) | !62361 (closed)
  • Background workers / Cron jobs to actually perform the business logic | TODO

Screenshots (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.

  • 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

Related to #268356 (closed)

Edited by Sean Arnold

Merge request reports