1

I want to create the following flow:

I have some program which is making a REST CALL to one of my builds, it could make it any time in a day, but i don't want this my jennkins build to be executed immediately, only in a specific interval of time E.G between 3-5 AM, but only if it has been triggered by the REST Call. Is there any plugin or a way to do it ?

Jesse Glick
  • 24,539
  • 10
  • 90
  • 112
Alex Brodov
  • 3,365
  • 18
  • 43
  • 66

1 Answers1

0

The easiest way would probably be to do some PowerShell scripting and an additional job:

  • Create an empty dummy job (This will be the one you trigger through the REST api)
  • Create another job, which will be the one you actually want to execute within a specific interval of the day. Use a Cron Build Trigger to setup when the job should execute in case of a trigger
  • Using the PowerShell Plugin and Run Condition Plugin, write some PowerShell code using the Jenkins REST api to fetch information about the "dummy" job. Here you will check whether the dummy job has run (triggered) or not today, and then you can decide with the Run Condition build step, if you want to proceed with the build.
Community
  • 1
  • 1
Thomas T
  • 697
  • 1
  • 7
  • 19