[Buildbot-devel] doStepIf function

rmdugal at hotmail.com rmdugal at hotmail.com
Wed May 26 11:39:55 UTC 2010


I have set properties in previous step(s) then the doStepIf function checks 
if those properties have specific values.

--------------------------------------------------
From: "Alexander O'Donovan-Jones" <Alexander at ccpgames.com>
Sent: Wednesday, May 26, 2010 7:23 AM
To: "Charles Lepple" <clepple at gmail.com>; "robert dugal" 
<rmdugal at hotmail.com>
Cc: "buildbot-devel" <buildbot-devel at lists.sourceforge.net>
Subject: RE: [Buildbot-devel] doStepIf function

> Since people have been talking about this, does anyone know the syntax to 
> query the result of a previous step?
> Something like:
>
> def doStepIf(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-----
> From: Charles Lepple [mailto:clepple at gmail.com]
> Sent: Monday, May 10, 2010 1:01 PM
> To: robert dugal
> Cc: buildbot-devel
> Subject: Re: [Buildbot-devel] doStepIf function
>
> On May 10, 2010, at 8:33 AM, robert dugal wrote:
>
>> I 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=(
>>                 (lambda(step):
>> step.build.getProperties().has_key("FOO"))
>>                 and
>>                 (lambda(step): step.getProperty("FOO") in fooList)
>>                 ), command='some command'))
>
> Something like this:
>
> #########
>
> def do_step_test(step):
>     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
> Buildbot-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/buildbot-devel
>
> 




More information about the devel mailing list