Reputation: 15953
Using Jenkins
, is it possible to limit job execution to run only once within a given interval?
E.g. I need to configure an expensive job which should be executed no more than 2 times per hour.
Note:
I was not able to get this working using the quiet period feature, because its timer will be reset once another build trigger occurs within the quiet period interval.
If such build trigger occur more often than the quiet period lasts, builds will never be made.
Upvotes: 2
Views: 4078
Reputation: 2088
If you want to run the job not more than 2 times in an hour then you can use Poll SCM trigger and set cron as H/30 * * * *. This performs scheduled check every 30 minutes.
Note - The build is not triggered if there are no changes in this 30 minutes.
Upvotes: 0
Reputation: 27485
You can always just schedule a build to be in twice-per-hour intervals. And once it triggers, manually check if there are SCM changes. If not, abort.
Edit:
Assumptions:
You may consider Build Result Trigger plugin. Configure the "upstream job" as the job to monitor (do not configure downstream from the upstream job). Configure the cron tab to run every 30 minutes 0,30 * * * *
Upvotes: 2