Here is the problem that I am having - I need to trigger a job build every 2 hours but only if there was a git commit(skip if there was no activity). I can solve them individually but not sure how to solve them together - anybody has any good ideas? The only one I can come up with is a cron job that would check every 2 hours and if there is a git commit during that time, trigger a job manually, but that does not look all that elegant.
Any good ideas appreciated.
Follow the steps as mentioned below to trigger a Jenkins job automatically based on GitHub's webhook configurations: Step 1: Go to the Configuration page of the respective job and under the build trigger section, check the "GitHub hook trigger for GITScm polling" checkbox and click on the Save button.
You can trigger build by following two methods: Poll SCM : periodically polls the SCM to check whether changes were made (i.e. new commits) and builds the project if new commits where pushed since the last build. build periodically : builds the project periodically even if nothing has changed.
Set jenkins up to use the "Poll SCM" trigger every 2 hours (0 */2 * * *) or something like that
It'll update from git and, if there was a change, trigger a build.
H H/2 * * *
Poll SCM will occur at random minute every random intervals of 2 hrs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With