[Buildbot-devel] what environment is used on slave builds?

Brian Warner warner-buildbot at lothar.com
Fri Jan 30 21:07:25 UTC 2004

> When a slave runs, what environment does it have?

The buildslave inherits the environment from whatever context 'twistd' was
executed. It is a daemonized child of twistd.

The slave commands (like 'rm -rf' and 'cvs') are executed with the
buildslave's environment plus whatever environment strings the buildmaster
told it to add for that particular command.

The 'Configure' build step has an 'env' argument which takes a dictionary of
environment variables to add to the autoconf-style ./configure step, useful
for specifying things like 'CFLAGS=-O2'.

> Anyway to get a slave to tell me what PATH it is trying to use?

The easiest way would be to edit slavecommand.py around line 153
(ShellCommand.start) and have it print a copy of its environment to the log:

    log.msg("command will be run with env=", self.environ)

You can also emit just the PATH component:

    log.msg("command will be run with PATH=%s" % self.environ["PATH"])

Another technique would be to add a BuildStep that runs /usr/bin/printenv,
like ShellCommand(command="printenv"). That will print the environment
variables to stdout, where it will be sent to the buildmaster and appear in
the web page.

If the PATH is incorrect and, say, 'cvs' cannot be found (perhaps it is in
/usr/local/bin), then I would expect the buildslave's start() method to throw
an exception, which should be reported back to the buildmaster. The error
message (something like "execvpe failed") should mention the fact that the
command could not be found. That error message should appear in both the
slave's log and the master's log.

I'll look into verifying that assumption (exceptions due to commands that
can't be found). I know that it's a common startup problem and it should
probably be easier to track down than looking through the logs for

good luck,

More information about the devel mailing list