This plugin adds the Subversion support (via SVNKit) to Hudson.
Once this plugin is installed, you'll see Subversion as one of the options in the SCM. See inline help for more information about how to use it.
The credentials for Subversion authorization are used from three places
- System wide global
- Hudson wide global
- Hudson Job specific
If you don't specify any SVN credentials in Hudson, Subversion plugin tries to use the System wide Global (usually something like /home/janedoe/.subversion). Otherwise a link is provided in the error message as shown below
Clicking on the "enter credential" link take you to a page where you can enter credentials.
If you specify the SVN credentials in Hudson and select yes for "override global credentials", then the SVN credential is stored in the job directory, this credential is specific to SVN configuration in that Job. Otherwise the credential will be stored as Hudson global, so that any job in Hudson with SVN configuration can be authenticated with that credential.
If you configure the job second time, now the SVN URL displays a link that says "Update Credential"
Usage with Server Certificates
An important note for those wanting to use client certificates to authenticate to your subversion server. Your PKCS12 cert file have a blank passphrase or a blank export password as it will cause authentication to fail. Refer to SVNKit:0000271 for more details.
Hudson can poll Subversion repositories for changes, and while this is reasonably efficient, this can only happen up to every once a minute, so you may still have to wait a full minute before Hudson detects a change.
To reduce this delay, you can set up a post commit hook so the Subversion repository can notify Hudson whenever a change is made to that repository. To do this, put the following script in your post-commit file:
UUID=`svnlook uuid $REPOS`
--header "Content-Type:text/plain;charset=UTF-8" \
--post-data "`svnlook changed --revision $REV $REPOS`" \
--output-document "-" \
UUID=`svnlook uuid $REPOS`
--header "Content-Type:text/plain;charset=UTF-8" \
--data "`svnlook changed --revision $REV $REPOS`" \
|Jobs on Hudson need to be configured with the SCM polling option to benefit from this behavior. This is so that you can have some jobs that are never triggered by the post-commit hook, such as release related tasks, by omitting the SCM polling option.|
The configured polling can have any schedule (probably infrequent like monthly or yearly). The net effect is as if polling happens out of their usual cycles.
|For this to work, your Hudson has to allow anonymous read access to the system. If access control to your Hudson is more restrictive, you may need to specify the username and password, depending on how your authentication is configured.|
|If your Hudson uses the "Prevent Cross Site Request Forgery exploits" security option, the above request will be rejected with 403 errors ("No valid crumb was included"). The crumb needed in this request can be obtained from the URL http://server/hudson/crumbIssuer/api/xml (or /api/json). This can be included in the wget call above with something like this:
--header `wget -q --output-document - \
Windows specific post-commit hook
The above script is difficult under the Windows command processor seeing as there is no support for backtick output extraction and there is no built in wget command. Instead the following contents can be added to post-commit.bat:
"%CSCRIPT%" "%VBSCRIPT%" "%REPOS%" %REV% "%SVNLOOK%" %HUDSON%
The batch file relies on the following VBScript being available in the file designated by the VBSCRIPT variable above:
repos = WScript.Arguments.Item(0)
rev = WScript.Arguments.Item(1)
svnlook = WScript.Arguments.Item(2)
hudson = WScript.Arguments.Item(3)
Set shell = WScript.CreateObject("WScript.Shell")
Set uuidExec = shell.Exec(svnlook & " uuid " & repos)
Do Until uuidExec.StdOut.AtEndOfStream
uuid = uuidExec.StdOut.ReadLine()
Wscript.Echo "uuid=" & uuid
Set changedExec = shell.Exec(svnlook & " changed --revision " & rev & " " & repos)
Do Until changedExec.StdOut.AtEndOfStream
changed = changed + changedExec.StdOut.ReadLine() + Chr(10)
Wscript.Echo "changed=" & changed
url = hudson + "subversion/" + uuid + "/notifyCommit?rev=" + rev
Set http = CreateObject("Microsoft.XMLHTTP")
http.open "POST", url, False
http.setRequestHeader "Content-Type", "text/plain;charset=UTF-8"
Build with Tags
If you would like to build hudson with a specific tag you can do the following:
Tag URL: https://hudson.dev.java.net/svn/hudson/tags
Under the project, click on the option "This build is parameterized". Next click the Add parameter dropdown and select the "List Subversion Tags" option.
For the name keep it simple like SVN_TAG. For the Repository URL set it to the URL: https://hudson.dev.java.net/svn/hudson/tags. The next step is to go under the Subversion plugin options. Under the Repository URL for the Subversion plugin:
As you can see in this picture we use the $SVN_TAG variable. That should work, just click save and execute a build.
Perform Polling from the Master
JIRA issue #5413 documents problems with running the SCM polling trigger on slaves. Version 1.21 of the Subversion plugin can perform the polling on the Hudson master if the hudson.scm.SubversionSCM.pollFromMaster system property is set to true.
Subversion Revision and URL information as Environment Variables
The Subversion SCM plugin has always exported $SVN_REVISION and $SVN_URL as long as your project only has one module location configured. With version 1.21 of the plugin, additional environment variables are available for projects that define multiple module locations. $SVN_REVISION_n and $SVN_URL_n are exported, where n is the 1-based index of the module in the configuration.
To connect to a Kerberos authenticated SVN repository see the Subversion Plugin HTTPS Kerberos authentication page.
Someone suggested in the Hudson IRC channel that if you are getting an error and a long svnkit stack trace that looks like:
ERROR: svn: authentication cancelled
org.tmatesoft.svn.core.SVNCancelException: svn: authentication cancelled
Version 2.3.10 (Aug 5, 2014)
- Upgrade to svnkit 1.8.5
- 438400 - 1.8 Is not a permitted Subversion Workspace Version in Manage Hudson
- 439300 - Selecting "Subversion Workspace Version" 1.7 checks-out workspace as 1.8
Version 2.3.9 (June 26, 2014)
- Upgrade to svnkit 1.8.3-1
- Add possibility to ignore notifications from post-commit hooks
Version 2.3.8 (February 15, 2012)
Add ability to use global variables in SVN Url.
Add cleaner message when authentication fails.
399165 - Issue with svn post-commit hook.
Fixed issue from email thread http://dev.eclipse.org/mhonarc/lists/hudson-dev/msg00374.html
Version 2.3.7 (Jan 23, 2012)
- Fix eclipse bug 390648.
- Test units only - Added port checker for svnserve.
Version 2.3.6 (Dec 03, 2012)
- Fix issue with noclassdef found exception.
Version 2.3.5 (Nov 26, 2012)
- Added svnswitch option (Thanks ofer_zelichover)
- Fix Eclipse bug 388344.
- Fix serialization issue with SVNUrl class.
Version 2.3.4 (Sep 14, 2012)
- SVN::Web support (Thanks Michael Vitz)
- Fix eclipse bug 387673. (Upgrade to svnkit 1.7.5)
Version 2.3.3 (Jul 10, 2012)
- Added svn 1.7 workspace option
- Fail build when file locked instead of fresh checkout.
Version 2.3.2 (May 29, 2012)
- Fix issue with storing svn credentials per job.
Version 2.3.1 (May 17, 2012)
- Upgrade to svnkit 1.7.4 for official svn 1.7 support.
- Fix Eclipse bug 376042.
Version 2.3.0 (Mar 23, 2012)
- Upgrade to svnkit 1.3.7 for support with svn 1.7.
- Major code cleanup and security fix.
Version 2.2.0_1 (Nov 30, 2011)
- Implemented: SVN list tags ordering, descending based on svn revision number (issue #9036)
- Fixed: Subversion Polling Log serialize error after upgrade to subversion-plugin (issue #8982)
Version 2.2.0 (Oct 26, 2011)
- Improved code style, added unit tests, implemented equals and hashcode methods required for Project cascading feature.
- Implemented subversion.credentials loading from the cascading parent projects.
- Improved svn credentials searching in case of matrix project.
- Updated hudson parent to 2.2.0.
Version 2.1.2 (Oct 7, 2011)
- Updated svnkit to 1.3.5
- Updated hudson parent to 2.1.2.
- Patched hudson.util.Digester2 was replaced with org.apache.commons.digester3.Digester.
Version 2.1.1 (Sep 2, 2011)
- Fixed: '/' is added incorrectly before '?' in WebSvn url (issue #5060)
- Fixed: SCM polling always return true when using specific revision in svn (issue #8554)
- Fixed: Builds aborted during SVN update are marked as FAILURE (issue #4605)
- Fixed: SVN fails to checkout in Matrix Jobs in Hudson 2.1.0 (issue #3)
- Improved PerJobCredentials handling. Use repo url without revision number for credentials key.
Version 2.1.0 (July 27, 2011)
- Fixed: User name vs username (issue #8922)
- Fixed: Excluded Users field with subversion doesn't accept users with dash (-) in name (issue #8700)
- Fixed: Subversion changes are listed multiple times (issue #2344)
- Improved layout and fixed some grammar problems
- Changed maven groupId to "org.hudsonci.plugins"
Version 2.0.1 (June 2, 2011)
- Fixed: Subversion plugin fails to render ChangeSet (issue #8837)
- Fixed: Workspace deleted when subversion checkout happens (issue #3580)
- Fixed: Setting SVN credentials for a job should not require administer permission (issue #8841)
- Fixed: Subversion Plugin failed while checking out (issue #7804)
- Fixed: Change set always shows "No changes" (issue #8852)
Version 2.0.0 (May 3, 2011)
- Added a new job parameter allowing to dynamically list svn tags
- Added Japanese localization
- Fixed form validation error whenever @revision was entered. Added revision validation
- Fixed Subversion Plugin does break native svn command line authentication, credentials missing after rewriting auth cache file (issue #8059)
- The need for Subversion command line options (issue #777)
- Resolve issue with overriding credentials during build execution from slave node
- Add option to clean workspace before each build (issue #3966)
- Force using HEAD SVN version for build. Added combobox for revision policy (issue #1241)
Version 1.23 (Jan 6, 2011)
- Introduced a new extension point to control the checkout behaviour.
- Added a new checkout strategy that emulates "svn checkout" by "svn update" + file deletion.
- Fixed revision number pinning problem (issue #8266)
- Fixed a per-job credential store persistence problem (issue #8061)
- Fixed a commit notify hook problem with Jetty (issue #8056)
Version 1.22 (Dec 10, 2010)
- Support revision keywords such as HEAD in repository URL configurations.
- Fixed StringOutOfBoundException. (issue #8142)
- Fixed "Unable to locate a login configuration" error with Windows Subversion server (issue #8153)
Version 1.21 (Nov 18, 2010)
- Expose Subversion URL and revision information for all modules in environment variables (issue #3445)
- Added system property to control whether SCM polling runs on the Hudson master or on slaves (issue #5413)
- Make sure stored credentials have restricted file permissions
Version 1.20 (Nov 1, 2010)
- Fixed a serialization issue.
Version 1.19 (Oct 29, 2010)
- Fixed a configuration roundtrip regression introduced in 1.18 (issue #7944)
- Supported svn:externals to files (issue #7539)
Version 1.18 (Oct 27, 2010)
- Requires Hudson 1.375 or newer.
- Builds triggered via the post-commit hook check out from the revision specified by the hook. The hook specifies the revision with either the rev query parameter, or the X-Hudson-Subversion-Revision HTTP header.
- Uses svnkit 1.3.4 now. (issue #6417)
Version 1.17 (Apr 21, 2010)
- Failure to retrieve remote revisions shouldn't result in a new build (issue #6136)
- Updated German & Japanese localization.
- Fixed that "svn log copier thread" is nerver destoryed if exception is thrown while checking out.(issue #6144)
Version 1.16 (Mar 23, 2010)
- Fixed issue #6030, where the new includedRegions feature broke the excludedRegions.
Version 1.15 (Mar 22, 2010)
- Added Spanish translation.
Version 1.14 (Mar 17, 2010)
- Add includedRegions feature, analogous to the excludedRegions feature (issue #5954).
Version 1.13 (Mar 8, 2010)
- Fixing polling for projects where last build was run on Hudson 1.345+ with Subversion plugin 1.11 or older (issue #5827)
Version 1.12 (Mar 3, 2010)
- Polling period can be set shorter than the quiet period now. (issue #2180)
- Exposed properties to the remote API. (report)
- Validation for "excluded users" field was too restrictive. (issue #5684)
- Avoid ClassCastException in change log computation if job SCM is changed from Subversion to something else. (issue #5705)
Version 1.11 (Feb 11, 2010)
- Allow commit comment to be provided when tagging. (issue #1725)
- Fix display of existing tags when there are multiple repositories.
- Minor updates to aid in debugging problems triggering jobs from a post-commit hook.
Version 1.10 (Jan 27, 2010)
- SSL client certificate authentication was not working (issue #5349)
- Make all links from help text open a new window/tab, to avoid leaving the config page when there are unsaved changes (issue #5348)
- Export tag information via remote API (issue #882)
Version 1.9 (Jan 16, 2010)
SSL client certificate authentication was not working ( issue #5230 )
- Tagging UI allows users to specify one-time credential for tagging (issue #2053)
- Fix a bug in the notifyCommit post-commit hook wrt a commit spanning multiple jobs (issue #4741)
Version 1.8 (Dec 23, 2009)
- Polling can now ignore commits based on configurable keywords in the commit messages. (patch)
- Several minor bug fixes
Version 1.7 (Sep 3, 2009)
- Fixed a bug in the exclusion pattern matching
- Fixed a bug in an interaction with the Trac plugin.
- Fixed a bug in the interaction of concurrent builds and Subversion polling (issue #4270)
Version 1.6 (Aug 28, 2009)
Version 1.5 (Aug 19, 2009)
- Polling is performed on the slaves now (report)
- "Tag this Build" fails for 1.311+ with SVN Plugin (issue #4018)
Version 1.3 (July 8, 2009)
- Subversion checkouts created files for symlinks (issue #3949)
Version 1.2 (June 24, 2009)
- Fixed "endless authentication to SVN when invalid user/password" issue (issue #2909)
Version 1.0 (June 15, 2009)