Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Get variables from Build Request #3817

jamuirhx ·

What is the trick to getting variables from a Build Request? Whether I run the step on the QB Server or a QB Agent the HashMap returned from the getVariables() method always has zero size. For example:

groovy:

import com.pmease.quickbuild.BuildRequest;
import java.util.List;
import java.util.HashMap;

Long configId = 19641;
List<BuildRequest> requestList = system.getBuildEngine().getBuildRequests(configId);

logger.info("size " + String.valueOf(requestList.size()));

for (BuildRequest br : requestList) {
    logger.info(br.getId());
    HashMap<String, String> brVars = br.getVariables();
    logger.info("vars size " + String.valueOf(brVars.size()));
}

Gives the following log output:
11:09:36,659 INFO - size 1
11:09:36,660 INFO - 99bfa36f-cddd-4b61-82e5-afad7e68bb70
11:09:36,660 INFO - vars size 0

Thanks you,

James

  • replies 1
  • views 736
  • stars 0
robinshen ADMIN ·

The build request object only contains variables prompted when the build is manually triggered. If you want to get variables of a build, you may access the build object directly by calling system.buildEngine.getBuild(buildId), then call getVariableValues() against the build object.