Skip to content

Add GraphQL mutation to promote an issue to an epic

Alexandru Croitor requested to merge 233974-promote-issue-to-epic into master

What does this MR do?

Exposes promote issue to epic through GraphQL mutation

Promote to epic within project parent group

  • GraphqQL mutation
mutation {
  promoteToEpic(input: {
    projectPath: "gitlab-org/gitlab-shell", 
    iid: "1"     
  }) {    
    issue {
      id
      iid
      title
      state
      milestone {
        id
        title
      }
    }
    epic {
      id
      iid
      title
    }
    errors
  }
}
  • Response with success
{
  "data": {
    "promoteToEpic": {
      "issue": {
        "id": "gid://gitlab/Issue/2",
        "iid": "1",
        "title": "First issue",
        "state": "closed",
        "milestone": {
          "id": "gid://gitlab/Milestone/9",
          "title": "v3.0"
        }
      },
      "epic": {
        "id": "gid://gitlab/Epic/5",
        "iid": "3",
        "title": "First issue"
      },
      "errors": []
    }
  }
}
  • Response with error
{
  "data": {
    "promoteToEpic": {
      "issue": {
        "id": "gid://gitlab/Issue/2",
        "iid": "1",
        "title": "First issue",
        "state": "closed",
        "milestone": {
          "id": "gid://gitlab/Milestone/9",
          "title": "v3.0"
        }
      },
      "epic": null,
      "errors": [
        "Issue already promoted to epic."
      ]
    }
  }
}

Promote to epic to a specified group

  • Graphql mutation
mutation {
  promoteToEpic(input: {
    projectPath: "gitlab-org/gitlab-shell", 
    iid: "1",
    epicGroupPath: "gitlab-org/gitlab-sugroup-1"
  }) {    
    issue {
      id
      iid
      title
      state
      milestone {
        id
        title
      }
    }
    epic {
      id
      iid
      title
    }
    errors
  }
}
  • response with success
{
  "data": {
    "promoteToEpic": {
      "issue": {
        "id": "gid://gitlab/Issue/2",
        "iid": "1",
        "title": "First issue",
        "state": "closed",
        "milestone": {
          "id": "gid://gitlab/Milestone/9",
          "title": "v3.0"
        }
      },
      "epic": {
        "id": "gid://gitlab/Epic/6",
        "iid": "1",
        "title": "First issue"
      },
      "errors": []
    }
  }
}
  • response with error
{
  "data": {
    "promoteToEpic": {
      "issue": {
        "id": "gid://gitlab/Issue/2",
        "iid": "1",
        "title": "First issue",
        "state": "closed",
        "milestone": {
          "id": "gid://gitlab/Milestone/9",
          "title": "v3.0"
        }
      },
      "epic": null,
      "errors": [
        "Issue already promoted to epic."
      ]
    }
  }
}

Promote to epic to an inexistent group

  • Graphql mutation
mutation {
  promoteToEpic(input: {
    projectPath: "gitlab-org/gitlab-shell", 
    iid: "1",
    epicGroupPath: "gitlab-org/gitlab-sugroup-1/abracadabra"
  }) {    
    issue {
      id
      iid
      title
      state
      milestone {
        id
        title
      }
    }
    epic {
      id
      iid
      title
    }
    errors
  }
}
  • response
{
  "data": {
    "promoteToEpic": null
  },
  "errors": [
    {
      "message": "The resource that you are attempting to access does not exist or you don't have permission to perform this action",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "promoteToEpic"
      ]
    }
  ]
}

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

Edited by Alexandru Croitor

Merge request reports

Loading