Reputation: 303
I have two jobs, JobA and JobB, JobA runs every day at 13.00 and registers some payments. I want JobA to trigger JobB which verifies the payments, if and only if JobA is successful and JobB needs to be run the next day at 04.00
Any idea how to do this?
BR
Upvotes: 3
Views: 10392
Reputation: 21
You can use build job: step in pipeline (https://jenkins.io/doc/pipeline/steps/pipeline-build-step/) and quite period in seconds to trigger the job at required time.
EDIT:
The way i did
def currentDate = GregorianCalendar.getInstance()
If you want next day at 5 am
def plannedDate = new GregorianCalendar(currentDate.get(Calendar.YEAR), currentDate.get(Calendar.MONTH), currentDate.get(Calendar.DAY_OF_MONTH) + 1, 5, 0)
def quietPeriod = (plannedDate.getTime().getTime() - currentDate.getTime().getTime())/1000
Upvotes: 1
Reputation: 1736
I have not been able to find anything that will do this out of the box. You can, of course, schedule a job to build periodically, but that's not all that you want.
You could try one of these 2 ideas (I have not implemented either myself).
Upvotes: 2