| Issue 383: | post receive hooks | |
| 7 people starred this issue and may be notified of changes. | Back to list |
Affected Version: 2.1.1 Environment: What steps will reproduce the problem? 1. Push review commit to gerrit 2. Approve review 3. Submit review commit through gerrit What is the expected output? What do you see instead? I expect post-receive hooks to be run, sort of. They are not run. Please provide any additional information below. We have some post receive hooks that runs after successful push to communicate with bug tracking systems and other small things. Would be good if gerrit could "emulate" this behavior. I could not find a way to do the similar with post-commit hook (I don't know if gerrit runs that either), my git fu is not particular strong today. Or do you perhaps have another proposal how to solve this with gerrit?
Jan 11, 2010
Project Member
#1
Shane...@gmail.com
Jan 11, 2010
OpenAFS wanted hooks, and also had the same problem.
They solved it by creating a parallel copy of all project repositories
in another directory, and using replication with the native git code to
actually run the hook. So their configuration is like:
gerrit repo: /git/project.git
hook repo: /hook/project.git
replication.config:
[remote "run-hooks"]
url = /hook/${project}.git
receivepack = /path/to/git-receive-pack
This way anytime Gerrit creates/modifies/deletes a branch in the project
it manages (/git/project.git) it will use replication to notify the other
project.
The trick here is to ensure the receivepack property is configured to
the path of the git-receive-pack executable, otherwise Gerrit uses its
internal Java code to do the replication and won't fire the hook.
Jan 11, 2010
This depends on JGit supporting the native C hook protocol, which is https://bugs.eclipse.org/bugs/show_bug.cgi?id=299315
Status:
Accepted
Labels: -Type-Bug Type-Feature Component-JGit
Jan 14, 2010
Change Ic2f041a71c744d0938d79b1106c9119d6318731a adds hooks for most interesting events in Gerrit.
Jan 24, 2010
Thanks for this, perhaps something we could use in the future. Allthough I setup something like OpenAFS but instead of configuring replication in gerrit I do a normal push to the hook repository once a minute. We still commit to our repos outside of gerrit so this seemed like minimal fuss. Of course causes a small delay to push notifications but is not a problem.
Feb 26, 2010
Closing this as gerrit 2.1.2 will contain both hooks it can execute from $site_path/hooks, but also has an event monitor you can watch over an SSH connection. http://gerrit.googlecode.com/svn/documentation/2.1.2/cmd-stream-events.html http://gerrit.googlecode.com/svn/documentation/2.1.2/config-hooks.html Right now I don't see a great reason for why we should also run the individual project repository's own set of hooks. There isn't any policy to ensure the hooks get setup when a new project is created. Nor is there a sane behavior for what should occur if an update hook rejects a change Gerrit wants to make.
Status:
WontFix
Labels: FixedIn-2.1.2 |
|
| ► Sign in to add a comment |