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.

how to get grid resource informations #4653

jintaeson ·

Hello,

I want to set the execute condition of a step using Groovy so that the step is performed only if the node is included in a specific resource.

For example:
If there is a resource "agent_apps" and it includes a node "app1", I want the step to return true if the node assigned to the current step is included in the "agent_apps" resource, and false otherwise.

groovy:
import com.pmease.quickbuild.grid.GridNode

def step_node = step.getNode()
def step_hostname = step_node.getHostName()

Is there a way to check if "step_hostname" is included in "agent_apps"

  • solved #4
  • replies 3
  • views 41
  • stars 0
robinshen ADMIN ·

It is possible to check if a resource definition includes a specific node. However when evaluate the execute condition of a step, the node running that step is not known yet. "step" in your script actually refers the parent step, as this script is executed by the parent step.

jintaeson ·

Thank you for your reply.
How to check resource definition includes a specific node?(groovy script)

robinshen ADMIN ·

Below script can be used for this purpose:

groovy:

import com.pmease.quickbuild.Quickbuild;
import com.pmease.quickbuild.entitymanager.ResourceManager;

def resource = Quickbuild.getInstance(ResourceManager.class).get("someresource");
for (provider in resource.type.providers) {
if (provider.nodeSelection.matches(grid.getNode("agentname:8811"), [])) {
logger.info("found");
}
}