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.

Stopping agents after a build containing triggers is finished #3998

kururin ·

Hello

Quickbuild: 8.0.20

Here is our use case:
We have a configuration with many steps running on agent A. One of these steps is a trigger that will run on the same agent A.
All our agents are launched as service (not in console mode).
It works very well.
But...
Sometimes we need to restart the agents. We used to do it via the QB interface or in command line: agent.bat restart because we want the system to wait for the end of build before restarting the agent.
The problem is that when the build reaches the trigger step, QB waits a few minutes and the trigger is never fired. The build fails with the message:

Error allocating node for step 'master': Can not find any node matching specified criteria

I guess this is the expected behavior. But before filling a request, do you think it would be possible to make sure that the build finishes before stopping the agent, even if this build contains triggers?

Thank you
Mathieu

  • replies 7
  • views 79
  • stars 1
robinshen ADMIN ·

How is the node selection setting of master step defined in the triggered build?

kururin ·

The trigger passes a "node_to_run_on" variable to the triggered configuration:
node_to_run = ${node.getHostName()}:${node.getPort()}

Then master step of the triggered configuration has its node selection set to "On node with address equals to value of specified variable" and uses the variable "node_to_run_on".

That is, we are sure that the triggered configuration is running on the same agent as the configuration triggering it.

narwhal ·

on your triggered configuration could you write a node selection criteria step that waits until the agent is online again via groovy script?

robinshen ADMIN ·

Actually there is no easy way to run the triggered build as the agent is removed from server active agent list to prevent other builds stepping in. How about put build logic of triggered build directly into the triggering build as steps?

rpallares ·

Hi,

For lot of processes set up our logic as steps will give us too complex configurations.
Use triggers allow us to reduce our step duplications. Define everything as steps is not a solution for us.

The real problem is that as we request a stop, the agent cannot be triggered directly. A good solution would be to not inactive a build agent.
May be a new status should be introduced (Stopping or whatever). That agent status won't take tasks by agents allocator but it will still be able to finish it's steps and run new configurations only if it has been triggered explicitly (by address).
By the way it would be useful to have a specific node assignment named "Running on trigger node", but that's not the point.

In understand that this feature won't be available tomorrow, but it's not so hard to introduce. Without that we're not able to use the trigger strength and stop agents safely.

Please, find a way to use triggers efficiently and stop the agents serenely.

Thanks,
Rafael

robinshen ADMIN ·
kururin ·

Thank you Robin.