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

Tom Prince tom.prince at ualberta.net
Thu Jul 26 14:05:47 UTC 2012


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)

This code is untested, and would need more polish to be added upstream,
but demonstrates the basic idea (and simplicity of writing custom
buildsteps).

  Tom




More information about the devel mailing list