I run a Jenkins server on Linux that has a number of agents connected to it, some Linux and some Windows. All the jobs on the controller are managed using the Jenkins DSL.
At the moment I have an overarching Jenkins job ("parent job") that simply calls a number of other downstream jobs in a particular order.
The point of these jobs is handling patch management for some Windows Jenkins on-demand agents, so the pattern is:
- a simple job runs on the on-demand agent, simply to ensure it is made active (job 1)
- another job runs to install updates on the on-demand agent (job 2)
The on-demand agent is configure to shut off after 45 minutes of being idle.
The problem I have is that there are times where Windows updates take an extremely long time and we hit the time out, so the agent is shut down and the whole process breaks. I cannot change the timeout on the agent.
What I think I need to do is try to find a way to keep running job 1 on a timed loop until such time as job 2 is completed (say every 30 minutes), then stop running on loop, allow the parent job to finish, and then eventually allow the timeout to happen for the agent, but I haven't found a reliable way to do this. Has anyone had a similar requirement?