Creating MR from issue with custom hooks fails without custom output
Summary
When there is a custom hook set for a project that produces any output, this is not presented in the issue view after clicking 'Create merge request', instead it fails with a generic output.
Steps to reproduce
- Add a custom hook (either for a project, or general) that consistently fails with a custom error message as in the docs (
GL-HOOK-ERR:
) - Create an issue in the project
- Click "Create merge request" in the issue and notice the error flashed at the top not containing the hook output
Example Project
Reproduced in the the latest version, on 12-5-stable
.
What is the current bug behavior?
A generic message is returned when trying to create MR from an issue and a custom hook is preventing that.
What is the expected correct behavior?
The output from the custom hook, like it also happens in the MR page and widget.
Relevant logs and/or screenshots
==> /var/log/gitlab/gitlab-rails/production_json.log <==
{"method":"POST","path":"/repro1/test1/issues/1/create_merge_request","format":"json","controller":"Projects::IssuesController","action":"create_merge_request","status":422,"duration":265.57,"view":0.18,"db":4.24,"time":"2019-12-11T18:38:52.930Z","params":[{"key":"target_project_id","value":null},{"key":"branch_name","value":"1-test1"},{"key":"ref","value":"master"},{"key":"namespace_id","value":"repro1"},{"key":"project_id","value":"test1"},{"key":"id","value":"1"},{"key":"issue","value":{}}],"remote_ip":"**","user_id":1,"username":"root","ua":"**","queue_duration":37.78,"gitaly_calls":1,"gitaly_duration":213.43,"response":"null","correlation_id":"P9j9kyT2fx1","cpu_s":0.0922848329999999}
Possible fixes
It looks like we return 422 if we cannot create the MR and the MR dropdown flashes the generic error, perhaps we can also send the custom output through.
Edited by Catalin Irimie