since the latest GitLab introduced custom_hooks:
excerpt from pre-receive:
if GitlabAccess.new(repo_path, key_id, refs).exec && GitlabCustomHook.new.pre_receive(refs, repo_path) exit 0 else exit 1 end
The hooks are called and executed fine with one exception: puts are no longer routed to the std. console output. When I put a “puts” inside the GitLab pre-receive hook I see “remote: …” in my console. But when doing the “puts” inside my custom_hook the “puts” only get printed when the hook returns “exit 1”. When returning “exit 0” (the good case) the “puts” are not printed.
My custom pre-receive hook is as simple as that:
#!/opt/gitlab/embedded/bin/ruby ENV['PATH'] = '/opt/gitlab/bin:/opt/gitlab/embedded/bin:' + ENV['PATH'] #!/usr/bin/env ruby puts "Hello world!" exit 0