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

Chris Spencer chrisspen at gmail.com
Mon Apr 3 17:45:52 UTC 2017


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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.buildbot.net/pipermail/users/attachments/20170403/fdf5291e/attachment.html>


More information about the users mailing list