Adds create lifecycle mutation

What does this MR do and why?

This code change adds a new feature to create custom work item lifecycles in GitLab. A lifecycle defines the different statuses that work items (like issues or tasks) can have as they progress through a workflow.

The main additions include:

  1. New API endpoint: A GraphQL mutation called lifecycleCreate that allows users to create custom lifecycles with their own set of statuses and default settings.

  2. Feature flag support: Added a new feature flag check for work_item_status_mvc2 to control access to this experimental functionality.

  3. Service layer: Created a new CreateService that handles the business logic for creating lifecycles, including validation, permission checks, and automatic conversion of system-defined lifecycles to custom ones.

  4. Enhanced base functionality: Improved the shared base service to better handle status management, tracking user actions, and ensuring proper data relationships.

  5. Documentation: Updated the API documentation to describe the new mutation, its parameters, and return values.

References

  1. BE: Add mutation to create lifecycle (#548456 - closed)
  2. BE: Convert to custom statuses when create life... (#559001 - closed)

Screenshots or screen recordings

image

How to set up and validate locally

mutation LifecycleCreate($input: LifecycleCreateInput!) {
  lifecycleCreate(input: $input) {
    lifecycle {
      id
      name
      statuses {
        id
        name
        iconName
        color
        __typename
      }
      defaultOpenStatus {
        id
        name
        __typename
      }
      defaultClosedStatus {
        id
        name
        __typename
      }
      defaultDuplicateStatus {
        id
        name
        __typename
      }
      workItemTypes {
        id
        name
        iconName
        __typename
      }
      __typename
    }
    errors
    __typename
  }
}
{
  "input": {
    "namespacePath": "jashkenas",
    "name": "New lifecycle",
    "statuses": [
      {
        "name": "New to do",
        "category": "to_do",
        "color": "#ffffff"
      },
      {
        "name": "New Done",
        "category": "done",
        "color": "#ffffff"
      },
      {
        "name": "New Duplicate",
        "category": "canceled",
        "color": "#ffffff"
      }
    ],
    "defaultOpenStatusIndex": 0,
    "defaultClosedStatusIndex": 1,
    "defaultDuplicateStatusIndex": 2
  }
}

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Marc Saleiko

Merge request reports

Loading