Hello,
First of all - thank you very much for creating Gitlab I have been working with it for many years and I really like it (unlike Gerrit ). Onto the question then…
Overview
On self-managed Gitlab instance, in merge request view, on “merge” click, merge fails as expected (because of custom git hook) and custom error message is displayed. The problem is, the error message is not displayed well enough.
Background and details
I am trying to enforce specific content in commit messages on production branches. When developer works on development branch then there are no restrictions. When change is requested to go production via MR and CI pipeline passes, developer clicks “merge”. Then, the update git hook located in /var/opt/gitlab/git-data/repositories/@hashed/*/custom_hooks/update
checks if commits, which are about to be pushed to production branch (usually squash and merge), contain at least one of mandatory strings, like %INT_SW_CHANGE
or %INT_NO_SW_CHANGE
. If the hook fails, following info is displayed:
if [ -z "${required_message_tag}" ]; then
echo "GL-HOOK-ERR: Custom hook error." >&2
echo "GL-HOOK-ERR: Mandatory tag not found in commit message for ${rev}." >&2
echo "GL-HOOK-ERR: At least one of following tags is needed: %PR= %JID= %INT_SW_CHANGE %INT_NO_SW_CHANGE ." >&2
echo "GL-HOOK-ERR: See https://confluence.page.with.commit.message.guideline.com ." >&2
echo "GL-HOOK-ERR: If you have any questions or think your commit message is correct, contact address@mail.com" >&2
exit 2
fi
As you can see, there is a lot of text to explain what actually happened and how to deal with it. The message needs to be presented to user as clearly as possible.
What are you seeing, and how does that differ from what you expect to see?
When hook fails on “merge” click, the error is presented as oneline, wrapped blob which does not respect newline characters. Also Gitlab says “refreshing in 10 seconds” and after this period, the message disappears rendering user unable to fully understand what is happening.
If I refresh the page, then error message looks good and does not disappear:
Is there any setting which could force gitlab to go straight to “page refreshed” state after clicking “merge” button? Could you share your other thoughts on how to deal with the situation?
What version are you on?
- self-managed GitLab Community Edition 15.4.6
What troubleshooting steps have you already taken? Can you link to any docs or other resources so we know where you have been?
What I did check so far:
- google search
- Merge requests | GitLab
- forum.gitlab.com search