Allow discover by user-id as well as key-id in internal API
Description
The GL_ID environment variable is received as “key-#” when pushing via SSH, but “user-#” when pushing via UI (eg. merge request) or via API methods (eg. creating a branch).
We use the GL_ID in our hooks to call $API_URL/internal/discover?key_id=# to find the user name. However, there is no similar call for when the GL_ID == user-#.
Proposal
We would like the GL_ID to either be (1) consistent – i.e. always pass "key-#" -- or (2) allow internal/discover API method to also accept a user_id parameter.
I've attached a patch that would allow the latter (2) via "$API_URL/internal/discover?user_id=#".
Currently we are patching the internal.rb file after every upgrade, which we would prefer not to do. gitlab-rails.patch