Dynamic "Keep around minutes" according to Hetzner's hourly billing cycle
sandrinr opened this issue · comments
What feature do you want to see added?
This is a request for an optimization around how Jenkins manages spawned Hetzner server resources. Currently, the plugin lets idle resources stay around for a configurable amount of time of which the default is 10 minutes. This can lead to the situation where multiple nodes are created and torn down within the same hour.
Hetzner bills its server resources on a hourly basis. The customer pays for every started hour. Jenkins normally does not know about the potential future workload it has to cope with. By letting nodes run idle just before a new hour would be started, Jenkins could make maximum use out of the already spawned resources.
Upstream changes
No response
Hi @sandrinr, thanks for interesting idea.
I can see 2 potential issues here:
- If Jenkins controller's clock is skewed
- How retention strategy works
The number of minutes after which the strategy would like to be checked again. The strategy may be rechecked earlier or later than this!
This could lead in theory to consistent over-billing by one hour. So we would probably need some time buffer before whole hour is wrapped.
Will look into to it soon
With latest release you can now specify 2 different ways of how agent is shutdown.
Default being what was done until now to not break existing installations.
Second option will shutdown agent just before billing cycle completes:
As mentioned in comment above, there is safety buffer of 5 minutes.
@sandrinr looking forward for feedback 😉
Thanks a lot @rkosegi for providing this feature so quickly! Looking at our cloud statistics after the upgrade pretty much shows what I would expect.