Node provisioning with SimpleScheduledRetentionStrategy

22 vistas
Ir al primer mensaje no leído

Sara E

no leída,
19 jul 2021, 5:50:04 p.m.19/7/21
para Jenkins Users
We provision nodes using the "Launch Agent using Command on Controller" option in the node settings. This will call a script which creates a node in our internal cloud and starts the agent. The script takes 30 minutes to an hour to get a node, set it up and start the agent.

We also use the "Bring this agent online according to a schedule" in the "Availability" option. When we use this option, Jenkins keep checking if the node is online every couple of minutes and triggers another execution of the script without waiting for the first execution to complete (i.e. agent startup). This ends up creating multiple executions and overwhelms our cluster. Attached screenshot to give an idea.

From the log:
/var/log/jenkins/jenkins.log.1:2021-07-13 03:50:32.709+0000 [id=45]    INFO    h.s.SimpleScheduledRetentionStrategy#check: Trying to launch computer S1 as schedule says it should be on-line at this point in time
/var/log/jenkins/jenkins.log.1:2021-07-13 03:52:32.707+0000 [id=46]    INFO    h.s.SimpleScheduledRetentionStrategy#check: Trying to launch computer S2 as schedule says it should be on-line at this point in time

How can I stop Jenkins from not triggering the same script multiple times over and wait for the first execution to complete?
Node-provision.png

Ivan Fernandez Calvo

no leída,
20 jul 2021, 1:42:22 p.m.20/7/21
para Jenkins Users
The Availability is a little tricky, I think you have to make it the other way around. Instead of building the agent in the "Launch Agent using Command on Controller" build the agent on a scheduled job then you will have the agent only available when you launched the job. You probably need another scheduled job to unprovision the agent. The agent configuration would be a regular agent (JNLP, SSH, ...) with the type of connection you need and the Availability scheduled as you want.

Sara E

no leída,
20 jul 2021, 2:20:22 p.m.20/7/21
para Jenkins Users
Gotcha. I guess it needs to be a little more complex than just changing the Retention Strategy's check interval.

It seems to be a hard-coded value in SimpleScheduledRetentionStrategy.
Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos