Search code examples
jenkinsjob-scheduling

Can i limit number of execution per day for a build?


In Jenkins, i need to limit running job execution for only one times per day It's possible ?

My build it's just one batch command

I have one cron for execute my job with fix times and i can use URL for run my job manually too. If the job has already been executed, it must be blocked for the day

Thx for answers guys


Solution

  • So let assume that your job name called TestJob , Create another job called DisableEnable_TestJob. In the DisableEnable_TestJob configure it to be triggered using Build trigger Build Trigger Then you can use Job DSL plugin to disactivate a specific TestJob and then activate after the system time is midnight. Refer to this answer to see how to use it: Activate and disactivate a job using DSL plugin . You have to search only for how to wait until midnight time but that should not be an issue. Once the time is at 12:00 then you can activate the job again.

    Let me now if you need any more help