[Buildbot-devel] sourcing env vars from file

Dan Kegel dank at kegel.com
Sat Sep 29 00:11:33 UTC 2012


On Fri, Sep 28, 2012 at 4:42 PM, David Tucker <david.tucker at schange.com> wrote:
> Hi all, I have a master.cfg question.  Our existing build linux process requires developers to "source" a config script in their shell to set up the build environment,
> basically it's just a file with a bunch of "export" statements.  I can't figure out how to get this into our build factory.
>
> I've tried everything I can think of, the most obvious being:
>
>         factory.addStep(Configure(command=["source","setEnv1.sh"]))
>
> But that doesn't seem to work.
>
> I can use env={} to set each env var individually but that seem problematic.  ( and there are lots to set )  I really want the buildslave to use
> the same setup that the developers use so that when it changes the buildbot will change as well.
>
> Any ideas?

Yeah.  Write a shell script that does what you need, and call that from Python.

Actually, this is what should be done with all build logic.  No logic,
if possible,
should be in the buildbot config file.  I'm currently busily draining all the
project knowledge out of a large Buildbot config and putting it into a
'buildshim' shell script.  Each step of the build gets one buildshim argument,
so e.g. compiling is done by running 'buildshim compile', testing is done
with 'buildshim test', and installing build dependencies is done with
'buildshim install_deps'.

The shell script should ideally live with the project source code in its
top level directory.

That way, you can more easily switch back and forth between CI systems,
and developers can repoduce what the buildbot is doing without having
to read its config files.

This is, by the way, my current approach to solving the problem
that http://www.chromium.org/developers/testing/chromium-build-infrastructure/buildbot-annotations
addresses.
- Dan




More information about the devel mailing list