[Buildbot-devel] FYI: Code snippet to build patches by leaving comment on Gerrit

Kevin Funk kevin.funk at kdab.com
Sun Dec 14 14:13:50 UTC 2014


Hey,

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?

[1] https://wiki.openstack.org/wiki/GerritJenkinsGit
[2]   
https://github.com/buildbot/buildbot/blob/master/master/docs/examples/git_gerrit.cfg#L43

-- 
Kevin Funk | kevin.funk at kdab.com | Software Engineer
KDAB (Deutschland) GmbH&Co KG, a KDAB Group company
Tel. Germany +49-30-521325470, Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-independent software solutions
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5851 bytes
Desc: not available
URL: <http://buildbot.net/pipermail/devel/attachments/20141214/7d2f44c0/attachment.bin>


More information about the devel mailing list