SVN to Hudson/Jenkins - Repository Hooks
While you can set Hudson/Jenkins to poll SVN at specific times an alternative is to let SVN inform Hudson when a new change has been committed to the repository.
Requirements:
You will need access to the server that hosts your SVN repository.
You have a project setup and configured in Hudson.
Adding the SVN Plugin
The following Hudson plugin is installed, version 1.20 for this example.
From the Hudson Console:
Click Manage Hudson-Manage Plugins
Ensure the Subversion Plugin is added.
Adding the SVN Hook to SVN
Once the plugin has been added its time to update the SVN hook.
Using a text editor, VM or VIM edit the "post-commit" file in your SVN repository hooks directory.
An example based on the "Oracle Virutal Developer Days VM"
Repository directory:/home/oracle/labs/Dev_labs/svn_repos/otnvdd/hooks
File:post-commit
An sample "post-commit" file:
Verify your changes:
Once you have the SVN hook in place, its time to make a change in the source code to see Hudson automatically build.
Make a small change to a file in your project
Run the following SVN commands after your change has been made:
Checking Hudson Status
Revisit you Hudson admin console, http://localhost:7001/hudson
You should notice the project being built.
Note: For this work out of the box Hudson needs to allow anonymous read access to the system. If your Hudson has security you will need to pass user credentials, consult the Hudson documentation.
References:
http://wiki.hudson-ci.org/display/HUDSON/Subversion+Plugin
http://svnbook.red-bean.com/en/1.5/svn.reposadmin.create.html#svn.reposadmin.create.hooks
http://www.oracle.com/technetwork/community/developer-day/virtual-dev-day-wls-310924.html
Requirements:
You will need access to the server that hosts your SVN repository.
You have a project setup and configured in Hudson.
Adding the SVN Plugin
The following Hudson plugin is installed, version 1.20 for this example.
From the Hudson Console:
Click Manage Hudson-Manage Plugins
Ensure the Subversion Plugin is added.
Adding the SVN Hook to SVN
Once the plugin has been added its time to update the SVN hook.
Using a text editor, VM or VIM edit the "post-commit" file in your SVN repository hooks directory.
An example based on the "Oracle Virutal Developer Days VM"
Repository directory:/home/oracle/labs/Dev_labs/svn_repos/otnvdd/hooks
File:post-commit
An sample "post-commit" file:
Verify your changes:
Once you have the SVN hook in place, its time to make a change in the source code to see Hudson automatically build.
Make a small change to a file in your project
Run the following SVN commands after your change has been made:
Checking Hudson Status
Revisit you Hudson admin console, http://localhost:7001/hudson
You should notice the project being built.
Note: For this work out of the box Hudson needs to allow anonymous read access to the system. If your Hudson has security you will need to pass user credentials, consult the Hudson documentation.
References:
http://wiki.hudson-ci.org/display/HUDSON/Subversion+Plugin
http://svnbook.red-bean.com/en/1.5/svn.reposadmin.create.html#svn.reposadmin.create.hooks
http://www.oracle.com/technetwork/community/developer-day/virtual-dev-day-wls-310924.html
Comments
Post a Comment