Default.md MR template does not take precedence over Git commit message body on MR creation
What does this MR do and why?
As explained in #353548 (closed), when a Default.md
file exists in .gitlab/merge_request_templates
it is not utilised if a merge request description is already set, which is the case if the description is pre-populated via a git commit message, including "Closes" or "Related to" functionality.
This MR changes the way Default.md
is loaded in, and rather than it be done via the frontend automatically selecting the Default
template in the dropdown, we specify the description from the backend so we can inject ourselves at the right point (prior to any git commit message prefill or "Closes" or "Related to" text being added to the description).
Screenshots or screen recordings
NA
How to set up and validate locally
- Feature.disable(:mr_default_description_from_repo)
- Add a .gitlab/merge_request_templates/Default.md file in a repository
- Edit a file in the repository and add "Closes #x" to the commit message, where x is an issue in that project
- See that Default.md contents are not utilised
- Feature.enable(:mr_default_description_from_repo)
- Add a .gitlab/merge_request_templates/Default.md file in a repository
- Edit a file in the repository and add "Closes #x" to the commit message, where x is an issue in that project
- See that Default.md contents are now utilised
Feature flag
Given the sev 1 regression that occurred in #350358 (closed), I think it's safer to roll this out via a feature flag. In addition to being safer, it will allow for the tracking of any performance issues related to retrieving the template contents from the repository on the new MR page.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #353548 (closed)