[Buildbot-devel] Using environment on the slave side
Mateusz Loskot
mateusz at loskot.net
Fri Sep 29 02:28:55 UTC 2006
Roy S. Rapoport wrote:
> On Thu, Sep 28, 2006 at 11:29:46PM +0200, Mateusz Loskot wrote:
>> 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.
>
> Mateusz, I had a very similar issue here -- our build management system is
> actually managed as part of our build management system. That means that
> in order to actually invoke it, you need to know where the build management
> system build directory is. That directory's defined in the environment of
> each buildslave, but of course may be different on a per-buildslave basis.
>
> We solved this by allowing environmental variable interpolation -- so I've
> got a buildstep, for example, that's defined thus:
>
> bf.addStep(step.ShellCommand, name = name, command = \
> "%(workdir)s/tare/head/nightly/copy_tarball"
> )
>
> The patch to the slave code was minor -- here it is:
Roy,
Thank you very much for your patch!
I really like it.
Although, I decided to move back with my concepts and follow
Stefan's idea - buildslave is required to prepare environment
for Build it's going to run.
Your idea is good and would also work, but I think
I need to play & learn BuildBot quite longer,
then I'll be better prepared for some hacks.
Ideally, I'd like to use the concept of variables interpolation for
'env' parameter passed to build steps. May be with some kind of
"indicator" telling the ShellCommand object that particular variable is
not set with new value (from buildmaster) but it's requested to read
exising variable on the slave side.
For example
# master.cfg
env={ 'LANG': 'fr_FR',
'DATA_PATH' : '%(DATA_PATH)s/rasters' }
Here, LANG variable gets new value from buildmaster, but
for DATA_PATH, buildslave is requested to read DATA_PATH env defined
on slave machine and concatenate with 'rasters' string, directory.
Simply, the decision between
use-new-value-from-master (LANG) and
get-for-new-value-from-slave (DATA_PATH)
could be made by simple checking if there is '%' in a variable value.
Also, some diagnostics would be recommended to report if requested
environment variable is not set (report error if DATA_PATH is not set on
the slave).
I know it's very primitive, but I believe it would work quite well for
my environment.
So, I'll try to develop something when I have more time in a next
few weeks.
Cheers
--
Mateusz Loskot
http://mateusz.loskot.net
More information about the devel
mailing list