Question

i am looking for a way through which i can use a environment variable in Hudson. In hudson i am creating a parameterized build for a specific job with a boolean parameter say "Bool". Hence after invoking the build through "Build now" i get a checkbox "Bool"

I want to use this value in my plugin code. This "Bool" gets created as an environment variable whose value i want to retrieve.

build.getEnvVars() gives me all the variables but i want to use only "Bool"

Was it helpful?

Solution

Try this:

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();
  }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top