Extension point to prevent an agent from running builds in certain conditions

Hi, I'd need to prevent an agent from running builds under certain conditions based on which which build it is going to run or depending on the time of the day.

I tried with StartBuildPrecondition by getting the agent id from the instance of QueuedBuildInfo but it looks like the getBuildAgentId method returns null unless the build has explicitly been triggered to run on a specific agent, therefore it's not usable in this situation.

Ideas?

2 comments

Simone,

There is no extension point to influence agents to run a build, I've filed an issue on that.

For your current task you might try to modify build configuration's agent requirements programmatically to affect the agents it can run on.

0

Thanks Yegor, at the moment I'm planning to rely on BuildServerListener and programmatically enable or disable an agent by checking the condition each time a build is added to the queue.

0

Please sign in to leave a comment.