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.

Node Selection #4633

MFalkner ·

I've got a build that triggers another task on the same node but should run in parallel.
Therefore, in the second task, I selected the same Resource as the first task but set the Count to 0.
Unfortunately, this second task will not use the Resource defined but any other Resource.
What would be the correct approach to do this?

  • solved #2
  • replies 9
  • views 69
  • stars 0
robinshen ADMIN ·

To make sure that triggered build runs on same node:

  1. Configure trigger build step to pass a variable say, "triggeringNode", with value set to "${step.nodeAddress}"
  2. Configure node selection of master step of the triggered build to use option "On node with specified script evaluating to true", and specify script as:
groovy:
node.address == vars.getValue("triggeringNode")
MFalkner ·

Thanks Robin!
This will solve my problem; however, it's still kind of strange that you can enter a Count of 0 and then it does not even consider the Resource specified.

drdt ·

Interesting, I was about to post a similar issue: I would like to create an unlimited resource, so that any number of jobs could run on it, and I thought a way to implement that would be to set the resource count to zero. How should I do that instead?

robinshen ADMIN ·

Specifying it as "0" is meaningless. Will validate it to require a positive number

robinshen ADMIN ·

Interesting, I was about to post a similar issue: I would like to create an unlimited resource, so that any number of jobs could run on it, and I thought a way to implement that would be to set the resource count to zero. How should I do that instead?

You may use a very large number for resource definition. At resource requirement stage, a minimum value of 1 will be required. Specifying as "0" currently has the same effect as not requiring the resource.

MFalkner ·

As I'm not the only one asking for it, I would prefer to have it the way we expected it.
I have situations, where I want a task to have exclusive right to run on a resource, but some tasks may run in parallel.
You may argue I could specify e.g. 10 for the count of the resource and the ask for 6 for the exclusive one giving spare for 4 parallel tasks.
However, allowing 0 count would be much more obvious and less error prone.
Would it be worth filing a request for this?

robinshen ADMIN ·

Allowing it to be 0 is very confusing. Just avoid using resource in this case.

MFalkner ·

True, in most cases this will work.
But, if you have a pool of agents defined as a resource, and the additional task must run on any of those, it's more convenient just to use the resource instead a specific agent, that might happen to be down at that time.
And "confusion" I would not say, as drdt and me just expected this behavior.

robinshen ADMIN ·