I’ve been trying to implement Server hooks on a self-hosted Gitlab (CE) instance and its been working so far.
However, part of the custom_hooks validate if pushes to certain branches are squashed, so only allow one commit to being pushed and it displays an error message otherwise. This works fine on locally with
git push but not on the Merge Request.
According to the documentation, it allows Custom error messages to display on there but that doesn’t seem to work.
So I’ve a simpler version that always exits with an error to validate the error is showing properly.
Counting objects: 3, done. Delta compression using up to 4 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 1.03 KiB | 1.03 MiB/s, done. Total 3 (delta 1), reused 0 (delta 0) remote: GL-HOOK-ERR: My custom error message. To gitlab.digital.sample.co.uk:praveen.premaratne/dummy.git ! [remote rejected] develop -> develop (pre-receive hook declined) error: failed to push some refs to 'firstname.lastname@example.org:praveen.premaratne/dummy.git'
Gitlab version details
Is this documentation still update? Or does anyone able to help me with getting the error message to display on Merge Request?