Skip to content

Add GraphQL mutation for adding oncall rotation

Sean Arnold requested to merge 262857-creation-rotation-graphql into master

What does this MR do?

This adds the ability to create On-Call rotations via the GraphQL API.

feature flag: Like all On-call MVC work, this is behind flag oncall_schedules_mvc.

GraphQL Mutation example:

Mutation:
mutation newRotation($input: OncallRotationCreateInput!) {
  oncallRotationCreate(input: $input) {
    oncallRotation {
      id
      name
      startsAt
      length
      lengthUnit
      participants {
        nodes {
          user {
            id
            username
          }
          colorWeight
          colorPalette
        }
      }
    }
    errors
  }
}
Query variables:
{
  "input": {
    "projectPath": "root/autodevops-deploy-test",
    "scheduleIid": "1",
    "name": "Rotation 242",
    "startsAt": {
      "date": "2020-09-19",
      "time": "09:00"
    },
    "rotationLength": {
      "length": 1,
      "unit": "WEEKS"
    },
    "participants": [
      {
        "username": "root",
        "colorWeight": "WEIGHT_500",
        "colorPalette": "BLUE"
      }
    ]
  }
}
Response:
{
  "data": {
    "oncallRotationCreate": {
      "oncallRotation": {
        "id": "gid://gitlab/IncidentManagement::OncallRotation/2",
        "name": "Rotation 242",
        "startsAt": "2020-09-18T21:00:00Z",
        "length": 1,
        "lengthUnit": "WEEKS",
        "participants": {
          "nodes": [
            {
              "user": {
                "id": "gid://gitlab/User/1",
                "username": "root"
              },
              "colorWeight": "500",
              "colorPalette": "blue"
            }
          ]
        }
      },
      "errors": []
    }
  }
}

Screenshots (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • 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 #262857 (closed)

Edited by Sean Arnold

Merge request reports