Does Buildbot provide an environment variable in CI jobs to allow it's identification like e.g. Travis does with TRAVIS
?
Last I checked Buildbot does not set an environment variable which has for purpose to indicate that build code is being run through buildbot. In my own setup I do need a few variables that my build code uses so I've setup a dictionary like this:
from buildbot.plugins import util
env = {
'BUILDBOT': '1',
'BUILD_TAG': util.Interpolate("%(prop:buildername)s-%(prop:buildnumber)s"),
'BUILDER': util.Property('buildername')
}
This dictionary can then be used to configure builders:
util.BuilderConfig(
name="foo",
workernames=["a", "b"],
env=env, ...)
The env
parameter makes it so that all shell commands issued by this builder will use the environment variables I've declared in my dictionary.
I use BUILDBOT
to detect whether the code is running in buildbot at all. The other variables are passed over to services like Sauce Labs and BrowserStack in order to identify the builds there, or they are used for diagnostic purposes.