[Buildbot-devel] Setting default BuildStep values (e.g. timeout, description)

Greg Ward gerg.ward+buildbot at gmail.com
Wed Oct 24 19:11:29 UTC 2007

I'm trying to figure out a clean way to provide default values for
BuildSteps.  E.g. I think 20 min is too long as a default timeout for
ShellCommand, so I'd like to make it 5 min.  From reading the Buildbot
source, I really cannot see a clean way to do this.  One vile hack
that occurs to me:

  class MyBuildFactory(BuildFactory):
    def addStep(self, step):
      # assume the 0.7.6 style of passing a BuildStep object in
      if isinstance(step, ShellCommand) and
step.remote_kwargs.get("timeout") is None:
        step.remote_kwargs["timeout"] = DEFAULT_TIMEOUT

Gross.  I suppose I could subclass ShellCommand, override the
constructor, and tinker with its kwargs.  But then what if I want to
use Buildbot-supplied ShellCommand subclasses like Configure or

Related problem: for BuildSteps with a distinct 'description', I always do

  factory.addStep(StepClass(name="do-some-stuff", description="do some
stuff", ...))

Obviously I could trivially derive description from name and save
myself some typing.  I don't want to override every BuildStep class
that happens to have a 'description' attribute, so again the only
thing I can think of is to override BuildFactory.addStep():

  class MyBuildFactory(BuildFactory):
    def addStep(self, step):
      if hasattr(step, 'description') and step.description is None:
        step.description = step.name.split("-")

That's not quite as nasty as the 'timeout' hack above, so I can
probably live with it.  But does anyone have a better way?

Thanks --


More information about the devel mailing list