Search code examples
buildbotcodebase

With Buildbot Source Step: why can 'codebase' not be set via Interpolate while 'repourl' can?


I have a factory that I use in several builders and I set builder specific settings via util.Property and util.Interpolate. While this works fine for repourl and branch it simply doesn't work for codebase. The following piece of code shows the source step how I would like to use it in my Buildbot configuration.

factory.addStep(
    steps.Git(repourl=util.Interpolate('git://repo_base_path/%(prop:build_repository)s', default=''),
              branch=util.Property('build_branch', default='master'),
              mode='full',
              codebase=util.Interpolate('%(prop:build_repository)s', default=''),
              method='copy', submodules=True, clobberOnFailure=True)
    )
)

Without the codebase part all worked fine. I then figured I would need to set the codebase for some cases so I added the codebase line, resulting in the following error:

[-] Configuration Errors:
[-]   error while parsing config file: sequence item 1: expected
      string, Interpolate found traceback in logfile

Does anybody know why it is not possible to set the codebase via Interpolate while it is no problem to do the same thing with repourl? Does somebody have an idea how to set the codebase for the source step to something different from '' and still not create a separate factory instance for every builder?

Any insights into this and any helpful suggestion is highly appreciated.


Solution

  • I think this is a bug in Buildbot. Looking at the Buildbot 0.8.12 sources, I can see that in buildbot/steps/source/git.py, in class Git, the renderables attribute includes "codebase", which should mean that you can use Interpolate in this way. Presumably some other code is assuming it can interpret codebase as a string at the time the configuration is parsed.

    In other words, as far as I can tell, you're doing something that the Git class claims to support.

    It looks like the old-style Git support in buildbot/steps/source/oldsource.py doesn't support codebase being a renderable, but it doesn't look to me like you're using that. I'm not entire sure, though, because I'm not sure what steps.Git refers to.