Port to EE for https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/17894/
https://gitlab.com/gitlab-org/gitlab-ce/issues/31591