Continuous integration 如何通过环境变量识别Buildbot环境?

Continuous integration 如何通过环境变量识别Buildbot环境?,continuous-integration,buildbot,Continuous Integration,Buildbot,是否在CI作业中提供环境变量以允许其识别,例如?上次我检查Buildbot时,未设置环境变量,该环境变量用于指示生成代码正在通过Buildbot运行。在我自己的设置中,我确实需要构建代码使用的一些变量,因此我设置了一个字典,如下所示: from buildbot.plugins import util env = { 'BUILDBOT': '1', 'BUILD_TAG': util.Interpolate("%(prop:buildername)s-%(prop:build

是否在CI作业中提供环境变量以允许其识别,例如?

上次我检查Buildbot时,未设置环境变量,该环境变量用于指示生成代码正在通过Buildbot运行。在我自己的设置中,我确实需要构建代码使用的一些变量,因此我设置了一个字典,如下所示:

from buildbot.plugins import util

env = {
    'BUILDBOT': '1',
    'BUILD_TAG': util.Interpolate("%(prop:buildername)s-%(prop:buildnumber)s"),
    'BUILDER': util.Property('buildername')
}
然后可以使用此词典配置生成器:

util.BuilderConfig(
    name="foo",
    workernames=["a", "b"],
    env=env, ...)
env
参数使此生成器发出的所有shell命令都将使用我在字典中声明的环境变量

我使用
BUILDBOT
来检测代码是否在BUILDBOT中运行。其他变量被传递给诸如Sauce Labs和BrowserStack之类的服务,以便识别那里的构建,或者用于诊断目的