TeamCity Runner Issues

bitbucket
scanner
csharp
sonarqube
(Brandon Gallagher) #1

Hello All!

First post here so please bear with me if I break any forum rules.

SonarQube: Developer Edition - Version 7.4 (build 18908)
Scanner: SonarScanner for MSBuild runner for TeamCity (please let me know where to find a version if it’s needed)

I’m attempting to add analysis to our project, and am a little unsure about how/where it belongs in a ‘proper’ flow. From what I’ve read, it looks like it should fit into the CI pipeline so I’ve added runner steps into our TeamCity build configuration.

I do have it working manually (when I execute the analysis from the command line myself), but when TeamCity executes the analysis I’m receiving the following:

*Starting: E:\sonarscanner-msbuild\MSBuild.SonarQube.Runner.exe "/d:sonar.password=*******" "/d:sonar.login=admin" end*

[22:44:09] **[Step 9/13]* in directory: E:\BuildAgent\work\a54d29361e069694*

[22:44:09] **[Step 9/13]* WARNING: ------------------------------------------------------------------------*

[22:44:09] **[Step 9/13]* This executable is deprecated and may be removed in next major version of the SonarScanner for MSBuild. Please use 'SonarScanner.MSBuild.exe' instead.*

[22:44:09] **[Step 9/13]* ------------------------------------------------------------------------*

[22:44:09] **[Step 9/13]* SonarScanner for MSBuild 4.6*

[22:44:09] **[Step 9/13]* Using the .NET Framework version of the Scanner for MSBuild*

[22:44:09] **[Step 9/13]* Post-processing started.*

[22:44:09] **[Step 9/13]* The SonarQube MSBuild integration failed: SonarQube was unable to collect the required information about your projects.*

[22:44:09] **[Step 9/13]* Possible causes:*

[22:44:09] **[Step 9/13]* 1. The project has not been built - the project must be built in between the begin and end steps*

[22:44:09] **[Step 9/13]* 2. An unsupported version of MSBuild has been used to build the project. Currently MSBuild 14.0 and 15.0 are supported*

[22:44:09] **[Step 9/13]* 3. The begin, build and end steps have not all been launched from the same folder*

[22:44:09] **[Step 9/13]* 4. None of the analyzed projects have a valid ProjectGuid and you have not used a solution (.sln)*

[22:44:09] **[Step 9/13]* Generation of the sonar-properties file failed. Unable to complete SonarQube analysis.*

[22:44:09] **[Step 9/13]* 23:44:09.348 Post-processing failed. Exit code: 1*

[22:44:09] **[Step 9/13]* Process exited with code 1*

[22:44:09] **[Step 9/13]* Process exited with code 1 (Step: Finish SonarScanner Analysis (SonarScanner for MSBuild: finish analysis))*

[22:44:09] **[Step 9/13]* Step Finish SonarScanner Analysis (SonarScanner for MSBuild: finish analysis) failed*

I see where it tells me to use SonarScanner.MSBuild.exe, but the runner doesn’t ever have me specify an executable at all so I’m not sure where/how I would override that default behavior.

I also had to disable SonarQubeAnalysisConfig.xml by appending .old to the filename in order to get this far. I’m not sure if that file is supposed to be auto-generated, but it was checked into source control with my local settings - which of course didn’t work on the build server.

As you can probably tell by now, I’m fairly confused… any advice or guidance is greatly appreciated!

FYI, I’m OOO for the rest of the week but I’ll respond next week when I get back.

Thanks,
Brandon

(G Ann Campbell) #2

Hi Brandon,

The docs should help on this: https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+MSBuild

Let us know if it’s not clear.

 
Ann

(Brandon Gallagher) #3

Hi Ann,

Thanks for getting back to me. I’ve definitely poured over the documentation, but it’s a little confusing… did yall develop the TeamCity runner? I’m wondering if it’s executing the wrong commands maybe?

Can you tell me about the SonarQubeAnalysisConfig.xml file? Is that file auto-generated by some process? It seems to be wrong in environment, but I don’t want to manually update it if it’s going to be overwritten. I also see that it stores the locations of a few of the scanner’s folders (like the conf directory). Since we’re using TeamCity, the path to this directory could change - how can I set those to be dynamically populated?

Thanks,
Brandon

(Brandon Gallagher) #6

Hi,

Any word on this? I only have this week to get SonarQube stood up so time is of the essence…

Thanks,
Brandon

(Andrei Epure) #7

Sorry for the late reply. We do not own the TeamCity integration. You could check the github repo TeamCity.SonarQubePlugin and the SonarQube Integration TeamCity documentation.

Related topic How to integrate SonarQube with Git and Teamcity