简体   繁体   中英

Gerrit hooks redirection

Are you using any hooks for gerrit? I need one to scan the patchset.

I tried to create update hooks under GIT_DIR/hooks/ , but gerrit will bypass that hook when merge, while it works when pushing to git directly. Then I tried to create gerrit_site/hooks/patchset_created with +x permission. I can see the error_log like ' echo $GIT_DIR ', but the message cannot redirect to user interface like ssh terminal. Also exit 0 and 1 doesn't block the pushing.

Is it possible for the gerrit hook acts as git one which can redirect message to user and block some patchset?

Is it possible for the gerrit hook acts as git one which can redirect message to user and block some patchset?

No. Gerrit hooks cannot block action and cannot redirect output back to the user. They run post-action, so the action is already done by the time the hook is called. See the official documentation at http://gerrit-documentation.googlecode.com/svn/Documentation/2.4.2/config-hooks.html

Adding pre-commit hooks is being worked on currently and will be available in future versions of Gerrit, likely as a plugin.

The best current option is to create a Gerrit hook which scans the patchset like you describe and then comments on the change in Gerrit using the ssh interface. At $dayjob, we use such a hook to give a -2 review score automatically to patches with commit messages which don't meet our standards.

它似乎没有记录,我自己还没有测试过,但是ref-update(没有ref-updated的d)钩子似乎可以满足您的要求: https : //gerrit-review.googlesource.com/#/ c / 31350 /

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM