Reputation: 5037
I am using Quickbuild 1.3 I want to export all runtime variables of a build job to a properties file.
I know that in Quickbuild you can refer to each variable and get its value using OGNL but I don't know how to get all available variables at runtime, and list them.
Do you know how to do that?
Thanks!
Upvotes: 1
Views: 3135
Reputation: 1937
seems like a lot of time since someone wanted this... anyway it might help somebody one day :)
${groovy:
import com.pmease.quickbuild.variable.VariableWrapper
for (VariableWrapper var : vars.getAll()) {
logger.warn(var.getName())
logger.warn(var.getValue())
logger.warn(var.asInt())
logger.warn(var.asBool())
if (var.getName().equals("CoolVar"))
var.setValue(666)
else
var.setValue("Strings are ok too")
/}
}
Upvotes: 1
Reputation: 1390
It is a really old version of quickbuild and you should defined change to a newer one if it's possible for you. you can access variables by using this expression:
${vars.getValue("yourVariableName")}
In the new versions you can also use groovy script to access all internal Java objects and write more complicated conditioned statements like:
${groovy:
message="Some message";
if(step.isFailed()) {
variable = vars.get("BUILD_DESCRIPTION");
if(variable != null) {
variable.setValue(message);
\}
\}
}
Upvotes: 1