[users at bb.net] Build priority function failing due to attribute error

Pierre Tardy tardyp at gmail.com
Mon Apr 3 18:52:48 UTC 2017


Hi Chris,
Since buildbot nine, a buildrequest can have several sourcestamps, because
it can be collapsed.
So there is no source attribute anymore, but a sources attribute, as per
source code:
https://github.com/buildbot/buildbot/blob/master/master/buildbot/process/buildrequest.py#L175

Can submit a documentation fix for this bug you found?

Thanks
Pierre

On Mon, Apr 3, 2017 at 7:45 PM Chris Spencer <chrisspen at gmail.com> wrote:

> I'm trying to create a build priority function, as outlined at
> http://docs.buildbot.net/latest/manual/customization.html#build-priority-functions,
> to ensure all non-staging branches are run first.
>
> My code looks like:
>
>     def nextBuild(bldr, requests):
>         for r in requests:
>             if r.source.branch == 'master':
>                 # Master always comes first.
>                 return r
>             elif r.source.branch == 'staging':
>                 # Ignore staging until the end.
>                 continue
>             else:
>                 # Otherwise, do the first build we see.
>                 return r
>         return requests[0]
>
>     c['builders'] = []
>     c['builders'].append(
>         util.BuilderConfig(name="runtests",
>             workernames=["example-worker"],
>             collapseRequests=True,
>             nextBuild=nextBuild,
>             factory=factory))
>
> However, this has stopped all builds from running, with the logs showing:
>
>     File
> "/usr/local/myproject/.env/local/lib/python2.7/site-packages/buildbot/process/buildrequestdistributor.py",
> line 237, in _getNextUnclaimedBuildRequest
>         nextBreq = yield self.nextBuild(self.bldr, breqs)
>     File "/usr/local/myproject/src/buildbot/master/master.cfg", line 130,
> in nextBuild
>         if r.source.branch == 'master':
>     exceptions.AttributeError: 'BuildRequest' object has no attribute
> 'source'
>
> Why is the BuildRequest object missing the source attribute, as referred
> to in the documentation? Is the documentation incorrect?
> _______________________________________________
> 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/107704fa/attachment.html>


More information about the users mailing list