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 
<https://github.com/jenkinsci/jenkins/blob/f6378676b11288cc2525852b0a1a441d147e31d3/core/src/main/java/hudson/slaves/SimpleScheduledRetentionStrategy.java#L119>
.

On Tuesday, July 20, 2021 at 10:42:22 AM UTC-7 [email protected] wrote:

> 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.
>
> El lunes, 19 de julio de 2021 a las 23:50:04 UTC+2, [email protected] 
> escribió:
>
>> 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?
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/856d558d-06c7-4fd8-9677-10323eea80d5n%40googlegroups.com.

Reply via email to