Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SCM Sensor fails with E170001 when using svn over ssh

Since sonar switched to using SVNKit I can't get the blame analysis to work for working copies using svn+ssh. It fails with:

[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.5:sonar (default-cli) on project example: Error when executing blame for file src/main/java/com/acme/Foo.java: svn: E170001: Authentication required for 'svn@svn+ssh://svn.acme.com' 

The svn command works properly when invoked from command line, also connecting to ssh [email protected] succeeds. I'm using SVNKit in Eclipse with this repository and it also works fine (although I had to tell it where to look for private key).

When I'm trying to debug the sonar runner execution I see the private key is simply not set:

myPreviousAuthentication    SVNSSHAuthentication  (id=392)  
    myAgentProxy    null    
    myIsPartial false   
    myIsStorageAllowed  false   
    myKind  "svn.ssh" (id=387)  
    myPassphrase    null    
    myPassword  (id=608)    
    myPortNumber    -1  
    myPrivateKeyFile    null    
    myPrivateKeyValue   null    
    myURL   SVNURL  (id=345)    
    myUserName  "jbochenski" (id=610)   
myPreviousErrorMessage  SVNErrorMessage  (id=388)   
    dontShowErrorCode   false   
    myChildErrorMessage null    
    myErrorCode SVNErrorCode  (id=614)  
    myMessage   "Credentials rejected by SSH server." (id=613)  
    myObjects   Object[0]  (id=616) 
    myThrowable null    
    myType  0   

The URL, username and password are all correct, but as you can see myPrivateKeyFile is null.

I've tried setting the private key path with MAVEN_OPTS='-Dsvnkit.ssh2.key=/home/acme/.ssh/id_rsa' as per SVNKit documentation, but it has no effect.

If run this on another working copy checked-out over https the analysis works fine, further confirming it's a problem with ssh authentication.

like image 290
Jakub Bochenski Avatar asked Oct 18 '22 15:10

Jakub Bochenski


1 Answers

This is indeed a missing feature. I have created the following ticket: https://jira.sonarsource.com/browse/SONARSCSVN-9

Would you mind testing this updated version of the plugin: https://github.com/SonarSource/sonar-scm-svn/releases/download/1.3-rc1/sonar-scm-svn-plugin-1.3-SNAPSHOT.jar

You should be able to pass additional parameters (or set them in the UI):

-Dsonar.svn.privateKeyPath=<path to private key>
-Dsonar.svn.passphrase.secure=<optional passphrase>

Report any sucess/issue directly in the pull request to not pollute SO: https://github.com/SonarSource/sonar-scm-svn/pull/4

like image 195
Julien H. - SonarSource Team Avatar answered Oct 21 '22 04:10

Julien H. - SonarSource Team