Ah, finally managed to work it out. Some context: I wish to send an email if a particular step failed, with relevant information.
###########
from buildbot.status.builder import Results, SUCCESS
def doStepIf(step):
allSteps = step.build.getStatus().getSteps()
firstStep = allSteps[0]
rc = firstStep.getResults()[0] # returns a tuple of (rc, string)
# if the rc == SUCCESS then don't continue, since we don't want to run this step
return Results[rc] == Results[SUCCESS]
###########
-----Original Message-----
From: ***@hotmail.com [mailto:***@hotmail.com]
Sent: Wednesday, May 26, 2010 11:40 AM
To: Alexander O'Donovan-Jones; Charles Lepple
Cc: buildbot-devel
Subject: Re: [Buildbot-devel] doStepIf function
I have set properties in previous step(s) then the doStepIf function checks
if those properties have specific values.
--------------------------------------------------
From: "Alexander O'Donovan-Jones" <***@ccpgames.com>
Sent: Wednesday, May 26, 2010 7:23 AM
To: "Charles Lepple" <***@gmail.com>; "robert dugal"
<***@hotmail.com>
Cc: "buildbot-devel" <buildbot-***@lists.sourceforge.net>
Subject: RE: [Buildbot-devel] doStepIf function
Post by Alexander O'Donovan-JonesSince people have been talking about this, does anyone know the syntax to
query the result of a previous step?
return step.build.previousStep.getResults()
I'm banging my head trying to work out the correct way to climb the ladder
to get this information :S
-----Original Message-----
Sent: Monday, May 10, 2010 1:01 PM
To: robert dugal
Cc: buildbot-devel
Subject: Re: [Buildbot-devel] doStepIf function
Post by robert dugalI cannot figure out the syntax for how to use doStepIf with a
function so that the step is only executed if certain conditions are
true. The condition needs to have some complex testing of builder
properties so I want to write this as a function.
How do I convert something like this below into using a function?
self.addStep(ShellCommand(
doStepIf=(
step.build.getProperties().has_key("FOO"))
and
(lambda(step): step.getProperty("FOO") in fooList)
), command='some command'))
#########
return step.build.getProperties().has_key("FOO") and
step.getProperty("FOO") in fooList
self.addStep(ShellCommand(
doStepIf = do_step_test,
command = 'some command')
#########
To make that work with lambda functions, I think you would need to put
the "and" inside a single lambda expression. The boolean "and" of two
function definitions won't get you what you want (not to be confused
with the *results* of two functions, "and"ed together).
http://docs.python.org/tutorial/controlflow.html#lambda-forms
------------------------------------------------------------------------------
_______________________________________________
Buildbot-devel mailing list
https://lists.sourceforge.net/lists/listinfo/buildbot-devel
------------------------------------------------------------------------------