[Buildbot-devel] Using environment on the slave side

Mateusz Loskot mateusz at loskot.net
Thu Sep 28 21:29:46 UTC 2006


Hi,

I'm a new user of BuildBot and I'm configuring it for a number of
projects. I'm working on as unified as possible configuration for all
BuildBot instances (projects).

I'd like to ask for some guidelines and possibilities regarding
environment variables usage. Here is the story.

Buildmaster lives on machine A.
Buildslaves are installed on separate matchines (X,Y,Z, etc.)
and connect remotely.

I set a requirement for all buildslave instances, to define environment
variable BUILHOME - absolute path to buildslave directory.
The idea is to make build steps working on all buildslaves,
all machines and systems *without* much configuring them,
just one env variable.

I use value of BUILDHOME to generate path to workdir or builddir.
I need to know absolute path to builddir.

For example, this path is used to set some environment variables for
steps running unit tests, like LD_LIBRARY_PATH, etc.

For example:

Buildmaster defines following step:

f1.addStep(step.ShellCommand,
        name="test",
        description=["running"],
        descriptionDone=["tests"],
        command=['/usr/bin/python','run.py'],
        workdir="unittests",
        env={ "LD_LIBRARY_PATH" : "???" }
)

I want to set LD_LIBRARY_PATH for this step.
The problem is that value of the LD_LIBRARY_PATH is different
on different slave machines but on every machine it's based on the
BUILDHOME variable.

Buildmaster only knows the name of env variable which
value it needs to pass to the build step.

Buildmaster does *not* know the value of this variable, because it's
different on different remote buildslave machines.

I also understand, I can not read (os.environ) and use
value of the BUILDHOME in the master.cfg, because the master.cfg script
is executed on buildmaster machine, but not on remote buildslaves.

So, I can not use something like this:

env={ "LD_LIBRARY_PATH" : os.environ["BUILDHOME"] }

Certainly, I could do it if all buildslaves live on the same
machine as buildmaster does.

Now, my questions are:

1. Is there any way to specify only name of env variable that value
will be read and used by build step?

2. Does 'env' parameter do the job?
How to use it in my case?


I've been thinking about defining new specialized BuildStep,
a subclass of ShellCommand.
Next, I could pass name(s) of env variables I want to
read (os.environ) and use on the buildslave side.
BuildStep is created on buildslave side so I understand and
believe it should work.

Does this idea make sense?
Is there any better or simpler way to gain behavior I explained above?

Thank you in advance for your help!

Cheers
-- 
Mateusz Loskot
http://mateusz.loskot.net




More information about the devel mailing list