SonarQube analysis in TFS Build fails after SonarQube upgrade - sonarqube

We are upgrading our SonarQube server from 6.1 to the 6.7.1 LTS. We are running TFS 2017 on-prem. I have updated the plugins to:
sonar-csharp - v 6.7.1.4347
sonar-css v 4.5
sonar-ldap - v 2.2.0.608
sonar-scm-git - v 1.3.0.869
sonar-scm-tfvc v 2.1.2
sonar-typescript - v 1.1.0.1079
sonar-web - v 2.5.0.476
sonar-xml v 1.4.3.1027
When running a build the complete analysis step fails Post-processing failed. Exit code :1
there are warning messages about sonar.cs.analyzer.projectOutPath property is missing.
And
"No roslyn issues report not found for this project"
Also, it suggests that I re-run the scanner using the -X switch. but I haven't been able to find how to add that switch.
Any help on how to determine what/where the error is would be SUPER helpful.

Have a look at this and this releasenotes. Check if you are using the latest scanner version: 4.0.2.892.

In our case, the SonarQube API being called in the build step happened to start failing on special characters that it had not had trouble with before. We were using curly-braces in our sonarQube project names, and the newer version really did not like that. Once we changed the project names to use parenthesis instead of the curly-braces, things were working better

Related

Incorrect Java coverage analysis result when executing the analysis via Jenkins

We run Sonar coverage analysis for multi-module Java projects in a Jenkins environment using the sonar-maven-plugin. We noticed that the coverage analysis results displayed on our Sonar dashboard are not correct for a handful of source files. One odd finding from my investigation is that I when I run the analysis from my local development laptop, the coverage analysis is correct (Sonar dashboard updated with the correct coverage percentages for those source files). Has anyone encountered any issues like this before?
Clarification:
The differences in the coverages are mostly between 0 and non-zero percent coverage. But I also see a couple of instances where the difference is between non-zero and non-zero percent coverage. Also, the differences correspond to source files from random packages, not any specific package. We are encountering this issue across various Sonar projects as well (so not just an issue specific to one of our Sonar project).
Also, when I import the Jacoco exec data file into Eclipse (using eclemma plugin), I do see the correct coverage percentages (non-zero). Furthermore, the coverage result when running the analysis locally can also be incorrect when compared with the result as interpreted by the EclEmma plugin). So, now it seems the analysis results may be incorrect regardless of which environments I run the analysis from (assuming the analysis result from EclEmma is correct).
Not sure why the coverage results is wrong only for a handful of the source files. I have compared both the client-side console logs and server side (Sonar server) logs -- but did not find any clues (no indication of error, both analysis were successful). I have also compared the coverages-xxx.pb files' sizes from the batch-report folder, but did not find any differences either.
Thanks in advance to anyone with suggestions on how I can troubleshoot this further! Please let me know if any additional information regarding the execution environments would be helpful.
Thanks,
Thinh
SONAR ENVIRONMENT:
- sonar-maven-plugin version: 3.3.0.603
- SonarQube version: 5.6.6
- sonar.java.source: 1.8
- sonar.java.target: 1.8
- sonar.sourceEncoding: UTF-8
SonarQube plugins:
- Findbugs 3.5 (findbugs)
- SonarJava 4.11.0.10660 (java)
- Git 1.2 (scmgit)
JENKINS ENVIRONMENT:
- Jenkins version: CloudBees Jenkins Enterprise 2.46.3.2-rolling
- Maven version: 3.1.1
- Java version: OpenJDK 64-bit Server 1.8.0_141
- Slave OS: 64-bit, CentOS (Red Hat 4.4.7-11), Linux version
2.6.32-504.12.2.el6.x86_64
LOCAL LAPTOP ENVIRONMENT:
- Maven version: 3.1.1
- Java version: Java HotSpot(TM) 64-Bit Server VM
(build 1.8.0_60-b27)
- OS: macOS Sierra, version 10.12.5

no matter what i do sonar refused to go beyond Unsupported major.minor version 52.0 in jenkins

I am trying to set up devops and have reached up-to sonarQube integration in jenkins. Now its not moving beyond "Unsupported major.minor version 52.0". I had java 1.8 but i installed 1.7 to remove this error. Still coming. Changed java version (checked in command line as well). JAVA_HOME, PATH, all those variable point to java 1.7. Still coming. I can run analysis on sonarqube server, if i try separately (localhost:9000) but in jenkins it's just refusing to go beyond this message. I am not from java background so i might be missing something obvious. Any help is appreciated
The JVM used to run the job must be >=Java 8. Whether or not you had it installed, the error you're getting indicates that Java 8 wasn't being used by the job.

SonarQube server shows zero unit tests

I’m integrating SonarQube in our build system – I installed sonar-runner-2.4 on our build agents and added the sonar-runner.properties for each solution (to the solution’s folder on TFS).
When running the build I’m executing the sonar-runner after the solution has been compiled on the build agent.
Everything seem to work except for the unit test:
On the build’s log I see that almost 200 tests ran and were completed successfully and in the sonar-runner log I see the following:
14:23:29.808 INFO - 583/583 source files analyzed
14:23:30.809 INFO - Sensor org.sonar.plugins.csharp.squid.CSharpSquidSensor#1a50b87 done: 14937 ms
14:23:30.809 INFO - Sensor org.sonar.plugins.csharp.core.CSharpUnitTestResultsProvider$CSharpUnitTestResultsImportSensor#97edbc...
14:23:30.821 INFO - Sensor org.sonar.plugins.csharp.core.CSharpUnitTestResultsProvider$CSharpUnitTestResultsImportSensor#97edbc done: 12 ms
Which seems ok I guess, but when logging into the sonar server it shows that 0 tests ran.
On the sonar-runner.properties file I set the following value to
sonar.cs.vstest.reportsPaths:
sonar.cs.vstest.reportsPaths=TestResults/*.trx
when in this case there are 3 vstest trx files located in the following local path on the build agent: `
D:\sTFS\22965\Sources\TestResults
` (see TestResults.jpg attached).
Attached is the sonar-runner.properties file.
I also attached a screen capture from the sonarqube server (see SonarServer.jpg attached).
Can you please advise what might be the problem?
You should be seeing some messages like:
INFO - Parsing the Visual Studio Test Results file ...
for each unit test result file that is being parsed, see VisualStudioTestResultsFileParser.java#L34
Can you try to pass an absolute path pattern to sonar.cs.vstest.reportsPaths? My guess is that the issue comes from the relative path.
By the way, the use of the sonar-runner to analyze .NET projects is being deprecated. You'll want to have a look at the MSBuild SonarQube Runner that offers very good integration with Team Foundation Server. See the new C# plugin documentation on SonarSource's Wiki: http://docs.sonarqube.org/display/PLUG/C%23+Plugin
EDIT
I just noticed the package name from your logs org.sonar.plugins.csharp.core.CSharpUnitTestResultsProvider. The .core. was present only in outdated versions of the C# plugin (in the 3.x series), and these versions might not support wildcards in report paths. Please upgrade to the latest version.

Sonarqube MaxPermSize error

Sonarqube software of department, demo and learning.
StartSonar.bat does not start.
Error Log below:
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=160m; support was removed in 8.0
I’m studied the error:
Jira task number:SONAR-5204 this jira status:closed and resolution:fixed will set.
MaxPermSize line in wrapper.conf was romeved.
wrapper.config and sonar.log files click.
Thanks for your help.
You are trying to run SonarQube with a JDK 8, which is not supported (yet). Please revert to a previous version (JDK 7 is perfectly suitable).
I also came across the same error; However, the problem was not about Java version. As I went and looked into the logs, it was found that I copied new version of FindBug library and there was a conflict as two FindBug library existed. Thus, it may be good idea to look into sonar.log file which could be found in sonar_install_directory/logs folder.

Having trouble getting started with SonarQube

I installed SonarQube and sonar-runner, and the web server seems to work just fine as I can browse it. I tried to keep things as simple as I could, I put the "sonar-project.properties" file in my project's source folder and gave . as the sonar.sources path. After doing so, the console output reported success and the web page listed my project and last analysis date, but when I went into the "Compare" tool to look at statistics it showed all items as blank, except for issues for which is displayed the number 0.
I edited the sonar-project.properties file to give the full path (instead of a relative current directory path of .) to my project's source code, replacing backslashes with forward slashes, and ran the sonar-runner command again from the command line while the working directory was the path of my source folder. It again reported success and when I reloaded the web page, it gave an updated last analysis date, but again no issues were reported and the statistics were all blank.
I have no idea what I'm doing wrong, the Sonar log only reports the installation and starting of the Windows service, and it doesn't indicate any problems. The StartNTService script starts the service without error, but the StartSonar script reports "jvm 1 | WrapperSimpleApp: Encountered an error running main: org.apache.catalina.LifecycleException: Failed to initialize component [StandardServer[-1]]". I don't know if that's relevant for the way I'm using SonarQube as a Windows service. I'm using pretty much all default configuration except I edited the sonar-runner.properties file by un-commented these lines:
sonar.host.url=http://localhost:9000
...
sonar.sourceEncoding=UTF-8
If anybody can help me figure out how to get this to work, I would greatly appreciate it. I am running Windows XP Pro x64 SP2 and Java 1.7.0_51 (32 bit). On my first attempt I did incorrectly use the 64 bit service install/launch scripts but when the console output indicated it didn't match the JVM architecture, I stopped and uninstalled the service and installed and launched the 32 bit service.
Edit: I'm using Sonarqube version 4.2 and Sonar-runner version 2.3.
By default, SonarQube is packaged with the Java ecosystem (Java, Checkstyle, PMD), but for C/C++ you will have to install one of the plugins that support analysis of these languages.
There is a commercial C++ plugin from SonarSource and a free Community Plugin.

Resources