[Buildbot-devel] sharing buildsteps

Greg Ward gerg.ward+buildbot at gmail.com
Mon Nov 19 19:01:19 UTC 2007


On Nov 19, 2007 11:23 AM, Stefan Seefeld <seefeld at sympatico.ca> wrote:
> So: what is the suggested way to share buildstep-related data among
> builders in a master config file ?

I don't know what the Official Recommended Best Practice is, but I
have been using good old-fashioned procedural abstraction.  E.g. my
master.cfg can build the trunk and several recent release branches.
Each branch requires three builders: linux-setup, windows-main, and
linux-main.  To avoid tedious repetition, I do something like this:

def create_setup_factory(checkout_source_opt):
    bfactory = MyBuildFactory()
    bfactory.addStep(shell.ShellCommand(
        name="checkout-projects-linux",
        command=["checkoutProjects",
                 "-d", cvsroot,
                 checkout_source_opt,
                 "build"],
        haltOnFailure=True,
        workdir=".",
        ))
    # ... more "setup" build steps ...

build_factories["setup"]["trunk"] = create_setup_factory("-Ltrunk")
for branch in active_branches:
    build_factories["setup"][branch] = create_setup_factory("-L%s" % branch)

Likewise I have functions create_windows_main_factory() and
create_linux_main_factory(), all used to populate the dict-of-dicts
build_factories.  When I have fully populated build_factories with
many BuildFactory objects, I stitch it all together for Buildbot:

def create_builders(name):
    """name is a branch name or \"trunk\"."""
    return [
        {'name': "setup.%s" % name,
         'slavenames': [linux_slave],
         'builddir': "setup.%s" % name,
         'factory': build_factories["setup"][name],
         'locks': [linux_slave_lock],
        },
        {'name': "windows-main.%s" % name,
         'slavenames': [windows_slave],
         'builddir': "windows-main.%s" % name,
         'factory': build_factories["windows-main"][name],
         'locks': [windows_slave_lock],
        },
        {'name': "linux-main.%s" % name,
         'slavenames': [linux_slave],
         'builddir': "linux-main.%s" % name,
         'factory': build_factories["linux-main"][name],
        },
        ]

c['builders'] = create_builders("trunk")
for branch in active_branches:
    c['builders'] += create_builders(branch)

Having said all that, I find that this generates a very confusing
waterfall page -- 9 builders today, with more and more in the future
as I add branches.  I'm hoping to drastically simplify it all with the
"custom build properties" patch (ticket #87).  Fingers crossed...

Greg




More information about the devel mailing list