[Buildbot-devel] Adding interpolated property in a build step

Alexander Sack pisymbol at gmail.com
Thu Jul 26 14:42:03 UTC 2012

On Thu, Jul 26, 2012 at 10:18 AM, Alexander Sack <pisymbol at gmail.com> wrote:
> On Thu, Jul 26, 2012 at 10:05 AM, Tom Prince <tom.prince at ualberta.net> wrote:
>> Alexander Sack <pisymbol at gmail.com> writes:
>>> Hello:
>>> I have read that build steps can set properties.  I'd like to have a
>>> step set a build property that will be interpolated at run-time and
>>> then re-used by another build step.
>>> Step X - create a file based on some interpolated properties, save the
>>> filename which is based on interpolated values in the build
>>> Step Y - use filename property
>>> The doc talks about setting shell based env and command based output.
>>> But how do I set a simple property from within a build step?  And can
>>> I use WithProperties()?
>> It is easy to write a build step that does this:
>> class SetProperty(BuildStep):
>>     renderables = [properties]
>>     def __init__(self, name, **properties):
>>         BuildStep.__init__(self, name=name)
>>         self.properties = properties)
>>     def start(self):
>>         for k, v in properties:
>>              self.setProperty(k, v, self.name)
>>         self.finish(SUCCESSS)

Okay the exact code that worked for me:

8 class SetBuildProperty(BuildStep):
9     """ Set a build property as a step """
11     renderables = ['properties']
13     def __init__(self, name = 'buildproperty', **properties):
14         BuildStep.__init__(self, name=name)
15         self.properties = properties
17     def start(self):
18         for k, v in self.properties.iteritems():
19             self.setProperty(k, v, self.name)
20         self.finished(SUCCESS)


SetBuildProperty(foo = WithProperties(%(bar)s.patch')

Again, thank you.  I really believe this should be added as a core
feature of ANY BuildStep (minimally the above should be part of the


More information about the devel mailing list