def conf = system.getConfiguration('root/A');
conf.getVar("xyz").setValue("123");
if i use "conf.variables.add(var);", it works. however, it would keep adding a new variable for each build.
def conf = system.getConfiguration('root/A');
def var = null;
for (each in conf.variables) {
if (each.name == "xyz") {
var = each;
break;
}
}
if (var == null) { // var "xyz" not defined in "root/A", so we add a new one (this effectively overrides the one defined in "root")
var = new com.pmease.quickbuild.variable.Variable();
var.setName("xyz");
var.setValue("123");
conf.variables.add(var);
} else { // the variable already defined in "root/A", so we simply change the value
var.setValue("123");
}
system.configurationManager.save(conf); // do not forget to save the configuratioin