Score:0

Trigger downstream Jenkins job on timed loop until upstream job has completed

ck flag

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?

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.