Hook to reject a merge _AFTER_ review

100 views
Skip to first unread message

Andreas Wederbrand

unread,
Apr 16, 2014, 4:03:50 AM4/16/14
to repo-d...@googlegroups.com
Hi!

I've been through the documentation but fail to find a hook that will run after review but before the actual merge. This would be the same as pre-receive in a repository using git without gerrit.

Here's a silly example to clarify what I want. Say I have a rule that no files get merge into master between 10 and 11. So you are allowed to do the actual git-review/push to gerrit at any time but if the review is done and submitted between 10 and 11 it should be rejected with a message "merge not allowed right now".

Is there such a hook?

Edwin Kempin

unread,
Apr 16, 2014, 4:06:19 AM4/16/14
to Andreas Wederbrand, Repo and Gerrit Discussion
You may write a plugin that implements a MergeValidationListener to do pre-merge validations
  https://gerrit-review.googlesource.com/Documentation/config-validation.html#pre-merge-validation

 

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Andreas Wederbrand

unread,
Apr 16, 2014, 4:23:58 AM4/16/14
to Edwin Kempin, Repo and Gerrit Discussion
Is that the only way?

While very powerful it seems also very complicated for simple tasks. Why not the option to run a simple script in the same way as ref-update but before merge instead of before push?

Edwin Kempin

unread,
Apr 16, 2014, 4:25:38 AM4/16/14
to Andreas Wederbrand, Repo and Gerrit Discussion
2014-04-16 10:23 GMT+02:00 Andreas Wederbrand <andreas....@gmail.com>:
Is that the only way?
I'm not aware of any other way.

Andreas Wederbrand

unread,
Apr 16, 2014, 1:00:49 PM4/16/14
to Edwin Kempin, Repo and Gerrit Discussion
I've now tried for quite some time to even get a basic plugin working. I'm running gerrit 2.8.* so I'm following https://gerrit-documentation.storage.googleapis.com/Documentation/2.8.4/dev-plugins.html#getting-started 

First error happens immediately:

[WARNING] Archetype not found in any catalog. Falling back to central repository (http://repo1.maven.org/maven2).

[WARNING] Use -DarchetypeRepository=<your repository> if archetype's repository is elsewhere.

[INFO] snapshot com.google.gerrit:gerrit-plugin-archetype:2.8-SNAPSHOT: checking for updates from gerrit-plugin-archetype-repo

Downloading: http://repo1.maven.org/maven2/com/google/gerrit/gerrit-plugin-archetype/2.8-SNAPSHOT/gerrit-plugin-archetype-2.8-SNAPSHOT.jar

[INFO] Unable to find resource 'com.google.gerrit:gerrit-plugin-archetype:jar:2.8-SNAPSHOT' in repository gerrit-plugin-archetype-repo (http://repo1.maven.org/maven2)


I'm following the guide exactly so if this is supposed to work I think the manual needs some changes.

Reply all
Reply to author
Forward
0 new messages