1

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!

orshachar
  • 4,837
  • 14
  • 45
  • 68

2 Answers2

1

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);
\}
\}
}
Pini Reznik
  • 1,380
  • 1
  • 12
  • 16
1

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")
    /}
}
Re'em
  • 1,869
  • 1
  • 22
  • 28