Insufficient privileges error with sonarRunner - jenkins

I am getting Insufficient privileges error running sonar. This started happening after I upgraded sonarQube to 5.0.
ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: Fail to decorate 'org.sonar.api.resources.File#152f931e[key=........]'
ERROR: Caused by: {"errors":[{"msg":"Insufficient privileges"}]}
For the existing projects, I renamed the key and now I have new sonar projects. Those seems to be working fine for now. The new projects that are created are throwing this error. Any suggestions?

The issue appears to be a bug in the Sonar Server 5.0 release.
https://jira.codehaus.org/browse/SONAR-6091
In order to work around it the 'SEE SOURCE CODE' project permissions can be set to include 'Anyone' from the admin page as in the below screen shot:
Obviously, this is not ideal in an unprotected environment because the source code can be viewed by anyone with access to the Sonar server API, but hopefully its addressed in the 5.1 release of Sonar Server.

The problem for me (Sonar 6.1) was caused by the creation of the project in SonarQube: at the first execussion of the scanner, it creates the corresponding project in SonarQube, what I didn't allow for all users...
Restore the right for creating projects allow the scanner to successfully work.

Related

ReSharper error when executing SonarQube analysis from TFS 2013 build

I have been setting up SonarQube analysis from a TFS 2013 build using the instructions made by Microsoft ALM Rangers:
https://vsarguidance.codeplex.com/downloads/get/1452516
It all Works fine, until I add ReSharper analysis, then i get an error;
09:51:49: ERROR: Error during Sonar runner execution
09:51:49: ERROR: Unable to execute Sonar
09:51:49: ERROR: Caused by: The property "sonar.resharper.cs.reportPath" must be set.
I have added a sonar-project.properties file to TFS in the same directory as my solution file.
The file looks like:
sonar.resharper.projectName=CommonComponents
sonar.resharper.cs.reportPath=resharperresults.xml
Im using SonarQube 5.1 and the R# 2.0 plugin
Running analysis from Jenkins Works fine.
I really hope you can help me out of this. Im pretty sure its something stupid that I just can't turn my eyes around to see.
The support of the R# by the MSBuild Runner is only going to become available in the version 1.0 of the MSBuild Runner & 2.0 of the R#. See the following tickets:
http://jira.sonarsource.com/browse/SONARMSBRU-16
http://jira.sonarsource.com/browse/SONARRSHPR-15

Sonar Failure because of org.sonar.plugins.surefire.api.SurefireUtils.getReportsDirectory(Lorg/sonar/api/resources/Project;)Ljava/io/File;

I have couple of groovy/ grails projects and i am using sonar-runner to analyze them. They worked perfectly until today I started receiving this error :
ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: org.sonar.plugins.surefire.api.SurefireUtils.getReportsDirectory(Lorg/sonar/api/resources/Project;)Ljava/io/File;
Not sure whats this, if somebody has experience this error before pls let me know
I had the same problem. The sonar-surefire-plugin-1.5.jar in your sonar/extensions.plugins/ directory I believe is the problem. I upgraded that to the 3.3.2 version from the maven repository; http://mvnrepository.com/artifact/org.codehaus.sonar.plugins/sonar-surefire-plugin, then restarted sonar and everything worked. I am running the sonar-groovy-plugin-1.0-SNAPSHOT from cloud bees but I had the problem with their jar as well.
Hmm... I had the same problem after installin of sonar 3.7.3 (the latest) Before it I have used sonar 3.5.X and all were OK. As possible solution: install previous version (3.6.X)
There's a compatibility issue between Java Plugins 1.5 and Groovy 0.6 (and also Flex 1.2). Related JIRA tickets: http://jira.codehaus.org/browse/SONARPLUGINS-3178 and http://jira.codehaus.org/browse/SONARPLUGINS-3259. Compatibility matrix updated: http://docs.codehaus.org/display/SONAR/Plugin+version+matrix

NullPointerException in Jenkins

I'm currently reading the book 'Jenkins Continuous Integration Cookbook', and I came across this error after building a project on Jenkins:
ERROR: Processing failed due to a bug in the code. Please report this to jenkinsci-users#googlegroups.com
java.lang.NullPointerException
at java.io.File.<init>(File.java:239)
at hudson.maven.MavenVersionCallable.call(MavenVersionCallable.java:58)
at hudson.maven.MavenVersionCallable.call(MavenVersionCallable.java:41)
at hudson.FilePath.act(FilePath.java:1001)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:604)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:567)
at hudson.model.Run.execute(Run.java:1604)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:506)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:246)
project=hudson.maven.MavenModuleSet#68f55ff2[A]
project.getModules()=[]
project.getRootModule()=null
I'm confused why I'm getting this, since my Java code is all autogenerated via Maven, and my tests in HTML format. I was able to successfully build the code using maven, before placing a directory with /src and pom.xml as it's children onto bitbucket.
Any ideas why this error is showing? Any advice will be appreciated.
Adding the rest of the error logs below (couldn't before because I was getting formatting errors).
FATAL: null
java.lang.NullPointerException
at java.io.File.<init>(File.java:239)
at hudson.maven.MavenVersionCallable.call(MavenVersionCallable.java:58)
at hudson.maven.MavenVersionCallable.call(MavenVersionCallable.java:41)
at hudson.FilePath.act(FilePath.java:1001)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:604)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:567)
at hudson.model.Run.execute(Run.java:1604)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:506)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:246)
According a similar bug report (but not exactly the same) I guess that your problem may be caused by a wrong configuration in Jenkins.
I suggest you to check the MAVEN_HOME used by Jenkins (i.e. check that it is really a MAVEN_HOME directory and is the correct maven version)

Maven plugin failed after upgrading Jenkins to 1.505

I have upgraded my Jenkins server to 1.505 but unexpectedly building with Maven plugin is not working and it throws an exception in the Jenkins logs
Error injecting constructor, java.lang.NoClassDefFoundError: hudson/ivy/AntIvyBuildWrapper
and after an hour googling this issue I found that Maven plugin guys upgrade their code base and it failed on an "optional" dependency, so I added the "optional plugin" but still it fails silently without any exception in the Jenkins logs.
the error appears on the console log is ERROR: Couldn't find Maven executable.
any hints ?!
The new maven plugin adds a new option to the Jobs I have (under the build section -> Invoke Maven 3 there is a new field called Maven version).
So what we need to do is open each job configuration page and hit the save button in order to save the default value and it will solve the problem.

Using Gallio with OpenCover coverage-report file contais result but Sonar reports 0%

I have the problem that the code coverage for some reason aren't presented in Sonar.
The result of the unit tests is performed and showed correctly but not the result of the code coverage. The project is build by Jenkins. I have registered the opencover.profiler.dll file as suggested in some threads but still I get no result. Neither I get any error messages in Jenkins when performing the build.
I would be most grateful for any tips on what to do.
Best regards Dan
I think this happens because your Jenkins service is running as "Local System account", but Sonar is running OpenCover with the -register:user switch under the hoods. You should be able to bypass this either by running the Jenkins service as a regular user account, or patch the Sonar-runner to omit the -register:user switch.
It turned out however that the PDB-files caused the problems. They were included in the repository and were for some reason not recreated by the build in Jenkins. The PDB-files therefor contained the wrong path to the actual code files.
Thanks for the help!
Check for version conflicts between OpenCover and the Gallio plugin.
I found that the later versions of OPenCover (starting with Version 4.0.1229) inserted a new tag in the coverage-report.xml file - which the Gallio plugin could not understand. When I rolled back to an older version of OpenCover (4.0.804) the coverage worked again.
You can find more details on http://sonar.15.n6.nabble.com/coverage-report-xml-is-generated-but-sonar-says-coverage-is-0-td5008850.html
It looks like the Gallio plug-in has been updated, but I haven't pursued that yet (wanted to first confirm that this was the cause of the problem).

Resources