closes https://gitlab.com/gitlab-org/gitlab-ce/issues/61385
continued from https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/32386