Search code examples
svnjenkinspost-commit-hook

Post Commit Hook - Jenkins: Starting jobs after Jenkins downtime


We have implemented a Post Commit Hook which starts our jobs on Jenkins. Our inspiration is this: Trouble with SVN post-commit and Jenkins

It works as intented and we have set polling for each job to blank as Yossi described.

My question is now: What do you do when the Jenkins server is down ? The commit is accepted anyways but the job isen't started as the Jenkins server is down... How do you ensure that the jobs are started when the server is started again?


Solution

  • If you are concerned about missed commit, you need to buffer the notifications to Jenkins. One possible scenario would be the following:

    Write the info to a file (database) when Jenkins is not available. You need a second process that reads the file (DB) periodically and pushes the info to Jenkins when Jenkins is available.


    A completely different option is to ignore the case when Jenkins is not available. When there are frequent changes to the source, then the next build will be triggered soon anyway. For the jobs where there are only infrequent changes you can use the Startup Trigger Plugin. You can also have a job triggered at startup that reads the files (db) from the previous example.


    In general, just go through the Jenkins Plugin list and let your imagination go wild with what the plugins can do for you. You might come up with very creative solutions.