在我的插件java文件中使用hudson系统变量

时间:2013-03-24 15:03:52

标签: java hudson hudson-plugins

我正在寻找一种可以在Hudson中使用环境变量的方法。 在哈德森,我正在为一个特定的作业创建一个参数化的构建,其布尔参数为“Bool”。 因此,在通过“立即构建”调用构建之后,我得到一个复选框“Bool”

我想在我的插件代码中使用此值。这个“Bool”被创建为一个环境变量,其值我想要检索。

build.getEnvVars()给了我所有变量,但我只想使用“Bool”

1 个答案:

答案 0 :(得分:0)

试试这个:

for (Entry e : build.getEnvVars().entrySet()) {
  if ("Bool".equals( e.getKey.toString() )) {
    // Do stuff with the Bool variable. To get the value of Bool variable do:
    // e.getValue().toString();
  }
}