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 exclude hosts? #4020

rmoog ·

Hello,

I have a massive QB installation and there are 2 resources that interest us: MSVS2013 and TOOLS.
There are over 20 hosts that have these 2 resources and they take part in compiling many QB configs. However, just 1 of these configs is experiencing a problem with most of the servers. This is why I thought, I should alter the problematic config in a way it would exclude known faulty hosts while the rest are unaffected. Normally I would create an extra attribute on these 20 machines and set it to a different value on hosts that are faulty for this 1 config, but due to the amount of hosts, I thought it would be a better use of my time to make the config discriminate against known faulty hosts in a Groovy script.

So, the node selection process involves "on node on which the script evaluates to true" with such script:

${groovy:
  def localhost = node.getHostName()
  def bad_hosts = ["ALPHA", "BETA", "DELTA", "GAMMA", "PHI", "ZETA", "OMEGA"]
  for(i = 0; i < bad_hosts.length; ++i) {
    if(localhost == bad_hosts[i]) return false
  }
  return true
}

However, running the config with such a script for selecting proper compile hosts ended up in QB skipping this step entirely.
What did I do wrong here?

  • replies 2
  • views 311
  • stars 0
narwhal ·

Try adding a node selection Matching all specified criteria, then have the first bit be your normal script/resource / named node selection. Then have your script for excluding hosts as a final condition.

robinshen ADMIN ·

Your script needs to be combined together with the "use specified resource" node selection rule. For instance, if node selection setting of you master step uses the resource, modify it like below:
If all below criteria evaluates to true

  1. current resource selection criteria
  2. your script