[Buildbot-devel] Persistent Properties
Greg MacDonald
gmacdonald at trionworlds.com
Fri Jun 26 20:41:48 UTC 2015
I found a solution. Thanks to Jared for his example which got me started. I created a build step to set properties based on past builds:
from buildbot.process import buildstep
from buildbot.status.results import SUCCESS, WARNINGS
from twisted.internet import defer
def getLastCLN(build):
currentBuildNumber = build.build_status.getNumber()
if currentBuildNumber == 0:
return None, None
builder = build.build_status.getBuilder()
for i in xrange(currentBuildNumber-1, 0, -1):
b = builder.getBuild(i)
if b is None or not b.isFinished():
continue
results = b.getResults()
if results not in [SUCCESS, WARNINGS]:
continue
revision = b.properties.getProperty('got_revision', None)
if not revision:
continue
return i, revision
return None, None
class GetLastRevision(buildstep.BuildStep):
def __init__(self, **kwargs):
buildstep.BuildStep.__init__(self, **kwargs)
@defer.inlineCallbacks
def run(self):
props = self.build.getProperties()
lastBuildNumber, lastRevision = getLastCLN(self.build)
if lastBuildNumber and not props.hasProperty('last_built_build'):
props.setProperty('last_built_build', lastBuildNumber, 'GetLastRevision', False)
if lastRevision and not props.hasProperty('last_built_revision'):
props.setProperty('last_built_revision', lastRevision, 'GetLastRevision', False)
yield defer.returnValue(SUCCESS)
From: Greg MacDonald
Sent: Friday, June 26, 2015 12:36 PM
To: Greg MacDonald; Jared Grubb
Cc: buildbot-devel at lists.sourceforge.net
Subject: RE: [Buildbot-devel] Persistent Properties
So I tried to use the REST API to gather the last successful revision for a custom renderable parameter, but the rest server appears to be on the same thread as the build step itself which causes a deadlock. Is there something else I could do? Only the current properties are passed in to the IRenderable. Could the database be consulted?
From: Greg MacDonald [mailto:gmacdonald at trionworlds.com]
Sent: Tuesday, June 09, 2015 10:55 AM
To: Jared Grubb
Cc: buildbot-devel at lists.sourceforge.net<mailto:buildbot-devel at lists.sourceforge.net>
Subject: Re: [Buildbot-devel] Persistent Properties
It’s for web purposes so I think Jim’s idea to use the REST api will work great.
From: Jared Grubb [mailto:jared.grubb at gmail.com]
Sent: Monday, June 08, 2015 7:55 PM
To: Greg MacDonald
Cc: buildbot-devel at lists.sourceforge.net<mailto:buildbot-devel at lists.sourceforge.net>
Subject: Re: [Buildbot-devel] Persistent Properties
This is for the web or for email purposes?
I have some code I can share for email if that’s your application.
Jared
On Jun 8, 2015, at 18:59, Greg MacDonald <gmacdonald at trionworlds.com<mailto:gmacdonald at trionworlds.com>> wrote:
Well, I was trying to keep track of the last successful revision for a UI simplification. But I think I’ll just not do this or query the database from the UI if I have to. Thx anyways!
-Greg
From: Thomas Middeldorp [mailto:thomas at ranzer.geek.nz]
Sent: Monday, June 08, 2015 6:37 PM
To: Greg MacDonald
Cc: buildbot-devel at lists.sourceforge.net<mailto:buildbot-devel at lists.sourceforge.net>
Subject: Re: [Buildbot-devel] Persistent Properties
I'm not sure if this is the best option, but you could write the property out to a file at the end of the build and then read it back in at the start of the next build with buildbot.steps.shell.SetPropertyFromCommand (cat/type the contents of the file).
- Thomas
On 9 June 2015 at 13:13, Greg MacDonald <gmacdonald at trionworlds.com<mailto:gmacdonald at trionworlds.com>> wrote:
Hi Everyone,
Is it possible to persist a property across builds outside of a rebuild? Thx.
-Greg
------------------------------------------------------------------------------
_______________________________________________
Buildbot-devel mailing list
Buildbot-devel at lists.sourceforge.net<mailto:Buildbot-devel at lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/buildbot-devel
------------------------------------------------------------------------------
_______________________________________________
Buildbot-devel mailing list
Buildbot-devel at lists.sourceforge.net<mailto:Buildbot-devel at lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/buildbot-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://buildbot.net/pipermail/devel/attachments/20150626/a095b827/attachment.html>
More information about the devel
mailing list