Module: Gitlab::QA::Support::ConfigScripts
- Defined in:
- lib/gitlab/qa/support/config_scripts.rb
Class Method Summary collapse
-
.add_git_server_hooks(docker, name) ⇒ Object
Add a git server hooks with a custom error message See docs.gitlab.com/ee/administration/server_hooks.html for details.
Class Method Details
.add_git_server_hooks(docker, name) ⇒ Object
Add a git server hooks with a custom error message See docs.gitlab.com/ee/administration/server_hooks.html for details
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/gitlab/qa/support/config_scripts.rb', line 9 def self.add_git_server_hooks(docker, name) global_server_prereceive_hook = <<~SCRIPT #!/usr/bin/env bash if [[ \\$GL_PROJECT_PATH =~ 'reject-prereceive' ]]; then echo 'GL-HOOK-ERR: Custom error message rejecting prereceive hook for projects with GL_PROJECT_PATH matching pattern reject-prereceive' exit 1 fi SCRIPT [ docker.exec(name, 'mkdir -p /opt/gitlab/embedded/service/gitlab-shell/hooks/pre-receive.d'), docker.write_files(name) do |f| f.write( '/opt/gitlab/embedded/service/gitlab-shell/hooks/pre-receive.d/pre-receive.d', global_server_prereceive_hook, false ) end, docker.exec(name, 'chmod +x /opt/gitlab/embedded/service/gitlab-shell/hooks/pre-receive.d/*') ] end |