Hudson Hell Part 2

Just when I think that I’ve got everything working I hit another issue. This time it’s with Subversion. I’m trying to create a new job so I select Subversion under the SCM section and enter the appropriate URL. Hudson tells me that I need to enter credentials so I click the link which takes me to the credentials page where I enter my username and password.

That produces this totally unhelpful error:

Passing user name someone and password you entered
Authentication was not acknowledged.
FAILED: svn: Operation cancelled

org.tmatesoft.svn.core.SVNCancelException: svn: Operation cancelled
    at hudson.scm.UserProvidedCredential$AuthenticationManagerImpl.checkIfProtocolCompleted(UserProvidedCredential.java:283)
    at hudson.scm.SubversionSCM$DescriptorImpl.postCredential(SubversionSCM.java:1885)
    at hudson.scm.SubversionSCM$DescriptorImpl.doPostCredential(SubversionSCM.java:1822)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:282)
    at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:149)

I’ve Google’d high and low for a solution to this one with no luck. This bug report against Jenkins is exactly what I’m seeing but there’s been no movement on that. The problem seems to be related to the file hudson.scm.SubversionSCM.xml which is found in the root of the Hudson home directory. I think the problem is the that credential manager isn’t (or perhaps can’t) write values into this file. I noticed from looking around in the other two jobs I have defined in Hudson that there was a file called subversion.credentials in the job directory which contains this:

<?xml version='1.0' encoding='UTF-8'?>
<hudson.scm.PerJobCredentialStore>
  <credentials class="hashtable">
    <entry>
      <string>http://svn.example.com/project/trunk</string>
      <hudson.scm.SubversionSCM_-DescriptorImpl_-PasswordCredential>
        <userName>user</userName>
        <password>password</password>
      </hudson.scm.SubversionSCM_-DescriptorImpl_-PasswordCredential>
    </entry>
  </credentials>
</hudson.scm.PerJobCredentialStore>

As far as I can see this file is the configuration for this particular job which sounds good to me. I copied the file into my new project and updated the path for the repository (the string element) and as if by magic everything started working. I was lucky in that the new job was in the same repository as one of my other jobs. I’m not sure what I would have done if I needed to replace the password.