[users at bb.net] Merging pending builds to the same branch?

Neil Gilmore ngilmore at grammatech.com
Mon Apr 3 14:51:26 UTC 2017


Chris,

If I understood your original question, you want to only build the most 
recent code. Buildbot 0.9.x doesn't do this by default. You'll find the 
relevant code in buildbot/process/buildrequest.py, down around line 275 
or so, in the function canBeCollapsed().

The original code (for 0.9.3, at least) reads:

         for c, selfSS in iteritems(selfSources):
             otherSS = otherSources[c]
             if selfSS['revision'] != otherSS['revision']:
                 defer.returnValue(False)
                 return
             if selfSS['repository'] != otherSS['repository']:
                 defer.returnValue(False)
                 return
             if selfSS['branch'] != otherSS['branch']:
                 defer.returnValue(False)
                 return
             if selfSS['project'] != otherSS['project']:
                 defer.returnValue(False)
                 return
             # anything with a patch won't be collapsed
             if selfSS['patch'] or otherSS['patch']:
                 defer.returnValue(False)
                 return

This means that builds with different revisions cannot be collapsed. 
You'll need a collapse request function. In our case, we just commented 
out the first clause in the original function in preference to providing 
a collapse request function (I may change that later if I get to it). If 
all the rest of the conditions are ones you want, you could just copy 
the original function and remove that first clause. You probably also 
want to change the returns from using defer to just returning the value.

Neil Gilmore
raito at raito.com

On 4/2/2017 11:54 AM, Chris Spencer wrote:
> Thanks, that's exactly what I was looking for.
>
> On Sat, Apr 1, 2017 at 6:10 PM, Bob Drummond 
> <bob.drummond at netronome.com <mailto:bob.drummond at netronome.com>> wrote:
>
>     This functionality exists. I've only used it with a function that
>     always returns true, not any tricky logic.
>
>     http://docs.buildbot.net/latest/manual/cfg-builders.html#collapsing-build-requests
>     <http://docs.buildbot.net/latest/manual/cfg-builders.html#collapsing-build-requests>
>
>
>
>     Bob Drummond
>     Software Engineer
>
>
>     Netronome | 3159 Unionville Road, Suite 100 Cranberry Twp., PA 16066
>
>     Phone: +1 (724) 778-3295 <tel:%28724%29%20778-3295> |
>     www.netronome.com <http://www.netronome.com>
>
>     On Apr 1, 2017 15:23, "Chris Spencer" <chrisspen at gmail.com
>     <mailto:chrisspen at gmail.com>> wrote:
>
>         Is there any configuration option to cancel pending builds to
>         a branch if there's a more recent pending build for that same
>         branch?
>
>         I'm seeing a case where there might be several commits made to
>         a branch of the course of an hour. I have my treeStableTimer
>         set to 60 seconds, so each commit is far enough apart to
>         create separate builds. I could fix this by increasing my
>         treeStableTimer to an hour or more, but then it'll take too
>         long to start the build.
>
>         Ideally, I'd like it to cancel older pending builds to a
>         branch if a newer one exists.
>
>         _______________________________________________
>         users mailing list
>         users at buildbot.net <mailto:users at buildbot.net>
>         https://lists.buildbot.net/mailman/listinfo/users
>         <https://lists.buildbot.net/mailman/listinfo/users>
>
>
>
>
>
> _______________________________________________
> users mailing list
> users at buildbot.net
> https://lists.buildbot.net/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.buildbot.net/pipermail/users/attachments/20170403/3b9fda3a/attachment.html>


More information about the users mailing list