[Buildbot-devel] Github pull request

Jamie Chen jachen at ucsd.edu
Sat Dec 14 20:29:59 UTC 2013


Hi,

I wasn't able to find the official support for a buildbot pull request
builder either.  Since Jenkins already had one and my developer base
requested something similar, I cobbled one up for my project (works on event
changesource and force scheduler).  Note Jenkins pull request builder works
on a schedule basis as well. It wasn't clear to me how that could be fit
into the buildbot framework since every build is based on a source stamp and
on a schedule you will be potentially building multiple opened pull
requests.  So I didn't pursue the route.

Just wanted to share what I've done and some issues I ran into:

. Changed buildbot/status/web/hooks/github.py to listen for github pull
request 'open', 'reopen', and 'sync' events in addition to commit push events.
. One challenge is pull request event does not have as much info as a push
event.  And I only tried to glean all the info from the event to fill the
source stamp and change lists.  (No commit history. Took the latest commit
on the pull request head as the one and only change. No user email info, etc.)

SourceStamp:
Repository	https://github.com/ooici/coi-services
Branch	refs/pull/1618/head:refs/remotes/origin/pr/1618
Revision	5815b5127238b786bd87a604833d34651d2e50fe
Got Revision	5815b5127238b786bd87a604833d34651d2e50fe
Changes	1 change

    Change #27227
    Category 	None
    Changed by 	usergithubid <usergithubid at localhost>
    Changed at 	Thu 12 Dec 2013 15:02:08
    Repository 	https://github.com/ooici/coi-services
    Branch 	refs/pull/1618/head:refs/remotes/origin/pr/1618
    Revision 	5815b5127238b786bd87a604833d34651d2e50fe
    Comments

    See pull request for comments.

    Changed files
        no files

. Since buildbot doesn't use 'refspec', I overrode the 'branch' field for
pull request refspec support.  I changed the build slave code slightly to
accommodate the 'branch' field for dual usage.

. Some minor customization of github status api to work on targeted builder
status, and on forced scheduler. 

You can check out the pull request builder in action here:
https://github.com/ooici/coi-services/pull/1618

Thanks.

Jamie
 








More information about the devel mailing list