Add a global server pre-receive hook with customised error message
What does this MR do and why?
Add support for testing Custom Error Messages on pre-receive hooks as part of https://gitlab.com/gitlab-org/gitlab/-/issues/362666.
See: https://docs.gitlab.com/ee/administration/server_hooks.html#custom-error-messages
This hook will be triggered on any project containing the substring 'reject-prereceive' .
Screenshots or screen recordings
How to set up and validate locally
exe/gitlab-qa Test::Instance::Image CE --no-tests --no-server-hooks
exe/gitlab-qa Test::Instance::Image CE --no-tests
# Check for the existence of the executable script depending on flag `/opt/gitlab/embedded/service/gitlab-shell/hooks/pre-receive.d/pre-receive.d` in the gitlab container that is spun up.
- Create a project that has 'reject-prereceive' in the project path (note you won't be able to Initialize repository with a README as the commit is rejected)
- Attempt to commit a file to project, and you'll see the Custom Error message rendered
- If you create a project that doesn't include this string (or changes the project to a different path) you will be able to commit again
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.
Edited by James Nutt