<div dir="ltr">Hi Chris,<div>Since buildbot nine, a buildrequest can have several sourcestamps, because it can be collapsed.</div><div>So there is no source attribute anymore, but a sources attribute, as per source code:</div><div><a href="https://github.com/buildbot/buildbot/blob/master/master/buildbot/process/buildrequest.py#L175">https://github.com/buildbot/buildbot/blob/master/master/buildbot/process/buildrequest.py#L175</a><br></div><div><br></div><div>Can submit a documentation fix for this bug you found?</div><div><br></div><div>Thanks</div><div>Pierre</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Apr 3, 2017 at 7:45 PM Chris Spencer <<a href="mailto:chrisspen@gmail.com">chrisspen@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg">I'm trying to create a build priority function, as outlined at <a href="http://docs.buildbot.net/latest/manual/customization.html#build-priority-functions" class="gmail_msg" target="_blank">http://docs.buildbot.net/latest/manual/customization.html#build-priority-functions</a>, to ensure all non-staging branches are run first.<br class="gmail_msg"><br class="gmail_msg"></div>My code looks like:<br class="gmail_msg"><br class="gmail_msg"> def nextBuild(bldr, requests):<br class="gmail_msg"> for r in requests:<br class="gmail_msg"> if r.source.branch == 'master':<br class="gmail_msg"> # Master always comes first.<br class="gmail_msg"> return r<br class="gmail_msg"> elif r.source.branch == 'staging':<br class="gmail_msg"> # Ignore staging until the end.<br class="gmail_msg"> continue<br class="gmail_msg"> else:<br class="gmail_msg"> # Otherwise, do the first build we see.<br class="gmail_msg"> return r<br class="gmail_msg"> return requests[0]<br class="gmail_msg"><br class="gmail_msg"> c['builders'] = []<br class="gmail_msg"> c['builders'].append(<br class="gmail_msg"> util.BuilderConfig(name="runtests",<br class="gmail_msg"> workernames=["example-worker"],<br class="gmail_msg"> collapseRequests=True,<br class="gmail_msg"> nextBuild=nextBuild,<br class="gmail_msg"> factory=factory))<br class="gmail_msg"><br class="gmail_msg"></div>However, this has stopped all builds from running, with the logs showing:<br class="gmail_msg"><br class="gmail_msg"> File "/usr/local/myproject/.env/local/lib/python2.7/site-packages/buildbot/process/buildrequestdistributor.py", line 237, in _getNextUnclaimedBuildRequest<br class="gmail_msg"> nextBreq = yield self.nextBuild(self.bldr, breqs)<br class="gmail_msg"> File "/usr/local/myproject/src/buildbot/master/master.cfg", line 130, in nextBuild<br class="gmail_msg"> if r.source.branch == 'master':<br class="gmail_msg"> exceptions.AttributeError: 'BuildRequest' object has no attribute 'source'<br class="gmail_msg"><br class="gmail_msg"></div>Why is the BuildRequest object missing the source attribute, as referred to in the documentation? Is the documentation incorrect?<br class="gmail_msg"></div>
_______________________________________________<br class="gmail_msg">
users mailing list<br class="gmail_msg">
<a href="mailto:users@buildbot.net" class="gmail_msg" target="_blank">users@buildbot.net</a><br class="gmail_msg">
<a href="https://lists.buildbot.net/mailman/listinfo/users" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.buildbot.net/mailman/listinfo/users</a></blockquote></div>