[Buildbot-devel] FYI: Code snippet to build patches by leaving comment on Gerrit
Mikhail Sobolev
mss at mawhrin.net
Fri May 15 15:34:25 UTC 2015
Hi Kevin,
I'm now reviewing all things Gerrit with Buildbot and checked your mail out :)
On Sun, Dec 14, 2014 at 03:13:50PM +0100, Kevin Funk wrote:
> I've implemented a small snippet to be able to build patches with Buildbot
> after leaving a specific comment on Gerrit. This is also something Jenkins
> seems to support out of the box [1]. You just have to post a comment a la
> "recheck" on Gerrit, the CI takes care of rechecking the patch and
> resubmitting the results to Gerrit.
>
> Implementation (based on [2]):
>
> # ...
> GerritChangeSource(..., handled_events=["patchset-created", "comment-added"])
>
> def acceptGerritCommentTrigger(change):
> trigger = "recheck"
>
> if "event.comment" in change.properties:
> comment = change.properties["event.comment"]
> if comment.endswith("\n\n" + trigger):
> return True
>
> return False
>
> return True
>
> # ...
> ChangeFilter(..., filter_fn=acceptGerritCommentTrigger),
>
>
> Question is:
>
> I'd love to see this upstream and support this out of the box, but I don't see
> a clean way to implement this given the current infrastructure (i.e. that
> ChangeFilter has no relation to Gerrit).
>
> Opinions?
I do not quite understand your concern of ChangeFilter having no relation to
Gerrit: it handles changes and Gerrit changes are like any other.
I believe this function could be added to buildbot/changes/gerritchangesource.py and,
with a bit of documentation, this would quite a useful addition.
--
Misha
More information about the devel
mailing list