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
[email protected]
https://lists.buildbot.net/mailman/listinfo/users

Reply via email to