Gitlab API doesn't allow group-level milestones when creating an MR

I am trying to automate some of our adminstrative processes with the gitlab API. One of those is setting the correct milestone on various merge requests. The documentation for adding a milestone to a merge request is here:

When I use milestone_id with the global ID of a milestone created on that project, it works. However, we use milestones on group-level (to sync multiple different projects). When I use exactly the same message, but with a group milestone ID, it’s silently ignored.

We are using GitLab Enterprise Edition v16.4.1-ee

Do I need to use a different format / different information / … when using a group milestone or is it impossible at the moment?

Note: I was testing with this command. It works when the milestone id is a project milestone, but fails when it’s a group milestone: curl -H "Content-Type: application/json" -X PUT https://<our-gitlab-server>/api/v4/projects/1234/merge_requests/5678 --data '{"milestone_id": 123}'

Some quick ideas:

  1. Is the project with the ID 1234 in the group where the milestone_id 123 is configured.
  2. Is the group milestone’s group the direct parent of the project? Or is it a group milestone higher up the tree (if yes, try creating a test milestone on the group that contains the project). Maybe a permission problem.
  3. Fetch the MR data on the command line, then navigate into the GitLab UI and manually assign the MR to the group milestone. Fetch the MR data again and compare the milestone dictionary - what has changed, and is the milestone ID really 123 or something else?

If the research brings no results, or the same results from your tests, suggest opening a bug report issue.

Thanks for your reply.

  1. Yes the milestone 123 is defined in a group that project 1234 belongs to.

  2. We have both cases: group/project and group/subgroup/project. It’s the same behaviour on both.

  3. After manually setting the milestone through the web UI the milestone dict is updated. I tried with both the milestone.id and milestone.iid values from that result in the milestone_id field of the API. If the value is a valid id for a project milestone => the MR is updated to that milestone. If it’s a group milestone ID => there is no error returned in the response, it is just silently ignored.

Thanks for testing. Sounds like it is not implemented yet. Would you mind opening an issue? Thanks!