Jenkins CI: How to trigger builds on SVN commit

continuous integrationJenkinsjenkins-pluginssvn

What plugins and plugin features do I need to set in order to get my Jenkins job to trigger a build any time code is committed to an SVN project?

I have installed both the standard SVN plugin as well as the SVN tagging plugin, but I do not see any new features that allow trigger configuration.

Best Answer

There are two ways to go about this:

I recommend the first option initially, due to its ease of implementation. Once you mature in your build processes, switch over to the second.

  1. Poll the repository to see if changes occurred. This might "skip" a commit if two commits come in within the same polling interval. Description of how to do so here, note the fourth screenshot where you configure on the job a "build trigger" based on polling the repository (with a crontab-like configuration).

  2. Configure your repository to have a post-commit hook which notifies Jenkins that a build needs to start. Description of the plugin here, in the section "post-commit hooks"

The SVN Tag feature is not part of the polling, it is part of promoting the current "head" of the source code to a tag, to snapshot a build. This allows you to refer to Jenkins buid #32 as SVN tag /tags/build-32 (or something similar).