gitaly-hooks

command
v14.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2021 License: MIT Imports: 23 Imported by: 0

README

gitaly-hooks

gitaly-hooks is a binary that is the single point of entry for git hooks through gitaly.

How is it invoked?

gitaly-hooks has the following subcommands:

subcommand purpose arguments stdin
check checks if the hooks can reach the gitlab server none none
pre-receive used as the git pre-receive hook none <old-value> SP <new-value> SP <ref-name> LF
update used as the git update hook <ref-name> <old-object> <new-object> none
post-receive used as the git post-receive hook none <old-value> SP <new-value> SP <ref-name> LF

Where is it invoked from?

There are two main code paths that call gitaly-hooks.

git receive-pack (SSH & HTTP)

We have two RPCs that perform the git receive-pack function, SSHReceivePack and PostReceivePack.

Both of these RPCs, when executing git receive-pack, set core.hooksPath to the path of the gitaly-hooks binary. That happens here in ReceivePackConfig.

Operations service RPCs

In the operations service there are RPCs that call out to gitaly-ruby, which then do certain operations that execute git hooks. This is accomplished through the with_hooks method here. Eventually the hook.rb is called, which then calls the gitaly-hooks binary. This method doesn't rely on git to run the hooks. Instead, the arguments and input to the hooks are built in ruby and then get shelled out to gitaly-hooks.

What does gitaly-hooks do?

gitaly-hooks will take the arguments and make an RPC call to PreReceiveHook, UpdateHook, or PostReceiveHook accordingly.

Note: Currently gitaly-hooks will only make an RPC call to PreReceiveHook, UpdateHook, or PostReceiveHook if a feature flag gitaly_hook_rpc is enabled. Otherwise, gitaly-hooks falls back to calling the ruby hooks directly.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL