SonarQube 7.2, VSTS Plugin 4.3.0 stop work with Pull request


(Nikita) #6

It happened because sonar-scanner-vsts pass values automatically :frowning:

async function populateBranchAndPrProps(props: { [key: string]: string }) {
  const collectionUrl = tl.getVariable('System.TeamFoundationCollectionUri');
  const prId = tl.getVariable('System.PullRequest.PullRequestId');
  const provider = tl.getVariable('Build.Repository.Provider');
  if (prId) {
    props['sonar.pullrequest.key'] = prId;
    props['sonar.pullrequest.base'] = branchName(tl.getVariable('System.PullRequest.TargetBranch'));
    props['sonar.pullrequest.branch'] = branchName(

(Rycornell) #7

I’m still seeing this in version 4.3.1 of the plugin.

(Julien Henry) #8

Hi @rycornell

Can you please provide the debug logs of the prepare task?


(Rycornell) #9
2018-07-06T10:30:16.4623460Z ##[section]Starting: Prepare analysis on SonarQube
2018-07-06T10:30:16.5547110Z ==============================================================================
2018-07-06T10:30:16.5592050Z Task         : Prepare Analysis Configuration
2018-07-06T10:30:16.5636340Z Description  : Prepare SonarQube analysis configuration
2018-07-06T10:30:16.5679780Z Version      : 4.3.1
2018-07-06T10:30:16.5723290Z Author       : sonarsource
2018-07-06T10:30:16.5779120Z Help         : [More Information](
2018-07-06T10:30:16.5835720Z ==============================================================================
2018-07-06T10:30:17.6661960Z SYSTEMVSSCONNECTION exists true
2018-07-06T10:30:17.9899740Z [command]/usr/bin/dotnet /agents/agent1/_work/_tasks/SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157/4.3.1/dotnet-sonar-scanner-msbuild/SonarScanner.MSBuild.dll begin /k:TestProject
2018-07-06T10:30:17.9962730Z SonarScanner for MSBuild 4.3.1
2018-07-06T10:30:18.0005480Z Using the .NET Core version of the Scanner for MSBuild
2018-07-06T10:30:18.1900970Z Default properties file was found at /agents/agent1/_work/_tasks/SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157/4.3.1/dotnet-sonar-scanner-msbuild/SonarQube.Analysis.xml
2018-07-06T10:30:18.1982570Z Loading analysis properties from /agents/agent1/_work/_tasks/SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157/4.3.1/dotnet-sonar-scanner-msbuild/SonarQube.Analysis.xml
2018-07-06T10:30:18.2057520Z Pre-processing started.
2018-07-06T10:30:18.2115540Z Preparing working directories...
2018-07-06T10:30:18.3868190Z 10:30:18.384  Updating build integration targets...
2018-07-06T10:30:18.3888550Z 10:30:18.387  Installed SonarQube.Integration.ImportBefore.targets to /root/.local/share/Microsoft/MSBuild/4.0/Microsoft.Common.targets/ImportBefore
2018-07-06T10:30:18.3908310Z 10:30:18.387  Installed SonarQube.Integration.ImportBefore.targets to /root/.local/share/Microsoft/MSBuild/10.0/Microsoft.Common.targets/ImportBefore
2018-07-06T10:30:18.3928760Z 10:30:18.388  Installed SonarQube.Integration.ImportBefore.targets to /root/.local/share/Microsoft/MSBuild/11.0/Microsoft.Common.targets/ImportBefore
2018-07-06T10:30:18.3947960Z 10:30:18.388  Installed SonarQube.Integration.ImportBefore.targets to /root/.local/share/Microsoft/MSBuild/12.0/Microsoft.Common.targets/ImportBefore
2018-07-06T10:30:18.3967630Z 10:30:18.388  Installed SonarQube.Integration.ImportBefore.targets to /root/.local/share/Microsoft/MSBuild/14.0/Microsoft.Common.targets/ImportBefore
2018-07-06T10:30:18.3987200Z 10:30:18.388  Installed SonarQube.Integration.ImportBefore.targets to /root/.local/share/Microsoft/MSBuild/15.0/Microsoft.Common.targets/ImportBefore
2018-07-06T10:30:18.4006670Z 10:30:18.388  Installed SonarQube.Integration.ImportBefore.targets to /root/Microsoft/MSBuild/15.0/Microsoft.Common.targets/ImportBefore
2018-07-06T10:30:18.4032010Z 10:30:18.389  Installed SonarQube.Integration.targets to /agents/agent1/_work/2/.sonarqube/bin/targets
2018-07-06T10:30:18.4056190Z 10:30:18.391  Creating config and output folders...
2018-07-06T10:30:18.4079040Z 10:30:18.391  Creating directory: /agents/agent1/_work/2/.sonarqube/conf
2018-07-06T10:30:18.4107650Z 10:30:18.391  Creating directory: /agents/agent1/_work/2/.sonarqube/out
2018-07-06T10:30:18.4131570Z 10:30:18.404  Fetching analysis configuration settings...
2018-07-06T10:30:18.4149580Z 10:30:18.408  Downloading from http://sonarqube:9000/api/server/version...
2018-07-06T10:30:18.5234730Z 10:30:18.521  Fetching properties for project 'TestProject' from http://sonarqube:9000/api/settings/values?component=TestProject...
2018-07-06T10:30:18.5262320Z 10:30:18.522  Downloading from http://sonarqube:9000/api/settings/values?component=TestProject...
2018-07-06T10:30:18.5860460Z 10:30:18.584  Downloading from http://sonarqube:9000/api/languages/list...
2018-07-06T10:30:18.6001200Z 10:30:18.598  Fetching quality profile for project 'TestProject' from http://sonarqube:9000/api/qualityprofiles/search?projectKey=TestProject...
2018-07-06T10:30:18.6028250Z 10:30:18.599  Downloading from http://sonarqube:9000/api/qualityprofiles/search?projectKey=TestProject...
2018-07-06T10:30:18.6734020Z 10:30:18.671  Fetching active rules for quality profile 'cs-sonar-way-53525' from http://sonarqube:9000/api/rules/search?f=repo,name,severity,lang,internalKey,templateKey,params,actives&ps=500&activation=true&qprofile=cs-sonar-way-53525&p=1...
2018-07-06T10:30:18.6770740Z 10:30:18.671  Downloading from http://sonarqube:9000/api/rules/search?f=repo,name,severity,lang,internalKey,templateKey,params,actives&ps=500&activation=true&qprofile=cs-sonar-way-53525&p=1...
2018-07-06T10:30:18.7931640Z 10:30:18.79  Fetching rules not active in quality profile 'cs-sonar-way-53525' for language 'cs' from http://sonarqube:9000/api/rules/search?f=internalKey&ps=500&activation=false&qprofile=cs-sonar-way-53525&p=1&languages=cs...
2018-07-06T10:30:18.7966500Z 10:30:18.791  Downloading from http://sonarqube:9000/api/rules/search?f=internalKey&ps=500&activation=false&qprofile=cs-sonar-way-53525&p=1&languages=cs...
2018-07-06T10:30:18.8875170Z 10:30:18.883  Local analyzer cache: /agents/agent1/_work/_temp/.sonarqube/resources
2018-07-06T10:30:18.9151190Z 10:30:18.91  Writing Roslyn generated ruleset to /agents/agent1/_work/2/.sonarqube/conf/SonarQubeRoslyn-cs.ruleset...
2018-07-06T10:30:18.9870570Z 10:30:18.982  Writing Roslyn analyzer additional file to /agents/agent1/_work/2/.sonarqube/conf/cs/SonarLint.xml...
2018-07-06T10:30:18.9945580Z 10:30:18.991  Provisioning analyzer assemblies for cs...
2018-07-06T10:30:18.9989220Z 10:30:18.994  Installing required Roslyn analyzers...
2018-07-06T10:30:19.0032800Z 10:30:18.996  Processing plugin: csharp version
2018-07-06T10:30:19.2965780Z 10:30:19.293  Cache miss: plugin files were not found in the local cache
2018-07-06T10:30:19.3026900Z 10:30:19.296  Fetching resource for plugin: csharp, version Resource:
2018-07-06T10:30:19.3107370Z 10:30:19.298  Downloading from http://sonarqube:9000/static/csharp/ to /agents/agent1/_work/_temp/.sonarqube/resources/0
2018-07-06T10:30:19.3191910Z 10:30:19.3  Downloading file from http://sonarqube:9000/static/csharp/ to /agents/agent1/_work/_temp/.sonarqube/resources/0/
2018-07-06T10:30:19.3348060Z 10:30:19.33  Extracting files to /agents/agent1/_work/_temp/.sonarqube/resources/0...
2018-07-06T10:30:19.4589440Z 10:30:19.455  Pre-processing succeeded.
2018-07-06T10:30:19.5039820Z ##[section]Finishing: Prepare analysis on SonarQube

(Rycornell) #10

I’ve attached the exact error below. It is slightly different that the error described in the post topic, but I believe I saw another community post that linked to this one. Also, we’ve since downgraded to SonarQube 7.1 and we do not receive the error.

2018-07-06T10:30:39.4725230Z ##[error]10:30:39.461 ERROR: Error during SonarQube Scanner execution
2018-07-06T10:30:39.4761590Z 10:30:39.461 ERROR: Error during SonarQube Scanner execution
2018-07-06T10:30:39.4923090Z ##[error]10:30:39.461 ERROR: Unable to load component class org.sonar.scanner.scan.ProjectLock
10:30:39.461 ERROR: Caused by: Unable to load component class org.sonar.scanner.scan.DefaultInputModuleHierarchy
10:30:39.461 ERROR: Caused by: Validation of project reactor failed:
  o To use the property "", the branch plugin is required but not installed. See the documentation of branch support:
2018-07-06T10:30:39.4984940Z 10:30:39.461 ERROR: Unable to load component class org.sonar.scanner.scan.ProjectLock
2018-07-06T10:30:39.5020950Z 10:30:39.461 ERROR: Caused by: Unable to load component class org.sonar.scanner.scan.DefaultInputModuleHierarchy
2018-07-06T10:30:39.5057220Z 10:30:39.461 ERROR: Caused by: Validation of project reactor failed:
2018-07-06T10:30:39.5094090Z   o To use the property "", the branch plugin is required but not installed. See the documentation of branch support:

(Julien Henry) #11

Sorry if I was not clear. Cloud you please enable VSTS debug logs (setting the variable system.debug to true when you queue your build). I’m interested to have the value of all build variables we are relying on to compute configuration (like Build.SourceBranch).


(Rycornell) #12
2018-07-11T09:54:44.0647510Z ##[debug]extraProperties=# Additional properties that will be passed to the scanner, 
# Put one key=value per line, example:
# sonar.exclusions=**/*.bin
2018-07-11T09:54:44.0674890Z ##[debug]set SONARQUBE_SCANNER_MODE=MSBuild
2018-07-11T09:54:44.0734700Z ##[debug]Processed: ##vso[task.setvariable variable=SONARQUBE_SCANNER_MODE;issecret=false;]MSBuild
2018-07-11T09:54:44.0758810Z ##[debug]set SONARQUBE_ENDPOINT=********
2018-07-11T09:54:44.0796030Z ##[debug]Processed: ##vso[task.setvariable variable=SONARQUBE_ENDPOINT;issecret=true;]********
2018-07-11T09:54:44.0822870Z ##[debug]set SONARQUBE_SCANNER_PARAMS={"":"http://sonarqube:9000/","sonar.login":********,"sonar.projectKey":"TestProject","sonar.projectName":"Test Project","sonar.projectVersion":"1.0","sonar.verbose":"true","sonar.sources":"TestProject","sonar.cs.opencover.reportsPaths":"**/*opencover.xml"}
2018-07-11T09:54:44.0864840Z ##[debug]Processed: ##vso[task.setvariable variable=SONARQUBE_SCANNER_PARAMS;issecret=false;]{"":"http://sonarqube:9000/","sonar.login":********,"sonar.projectKey":"TestProject","sonar.projectName":"Test Project","sonar.projectVersion":"1.0","sonar.verbose":"true","sonar.sources":"TestProject","sonar.cs.opencover.reportsPaths":"**/*opencover.xml"}

(Julien Henry) #13

Are you sure you give the correct build log? I can’t see any mention of being passed to the scanner.

(Rycornell) #14

Yes, that’s the problem. We do not set, but the error message indicates that we do.

(Mike Gott) #15

Hi. was there a resolution to this? I’ve recently upgraded to 7.2 and am also receiving the same error as the previous user. We are using the community edition and not passing explicitly.

(Nicolas Bontoux) #17

I see @smccollough created the new thread below, more specifically on the behaviour of VSTS extension 4.3.2:

Let’s follow-up there as this topic here started on VSTS extension 4.3.0, and VSTS-161 has been released in the meantime.

(Petr) #18

Same problem in version 4.3.2 after update SQ to 7.2.1. How to solve it? Problem is not in TFVC but in TFGIT repository. We want to analyze only one branch without pull request. Before update it works fine after update build failed. What is solution?
Edit: Prepare analysis is 4.3.2 and Run analysis is 4.3.0.

(Petr) #19

OK, my question could be … How to setup analyze to another branch than master? On master branch analyse works fine but we need setup analyze to developer branch (only one branch). Thanks.

(Petr) #20

It is very nice support. How it seem in payed version …?

Is there any chance to work with previous version? Our backup admin setup full dayly backup so backup from upgrade is not available. Need help because version 7.2.1 is not usable.

(Nicolas Bontoux) #21

Hi Petr,

There have been two kinds of error messages mentioned in this thread:

(pull-request related)


(branch related)

Which one are you encountering here ? If latter then as discussed it might worth following-up in this newer thread I mentioned. Specifically in light of your latest notes:

We want to analyze only one branch without pull request

How to setup analyze to another branch than master?

Below note might be insightful:

Which in turns means you cannot perform an analysis on another branch than master (with Git on VSTS ; related code fwiw).

(Petr) #22

Ok, before version 7.2 I was able to analyze another branch than master. I don’t want to analyze all branches. We have one developer branch and master branch. Before 7.2 we had analyzer to developer branch, after upgrade to 7.2 we got error To use the property “”, the branch plugin is required but not installed. Why? Is there any chance to say sonarqube that master branch is our developer branch? Or is there chance to analyze another branch than master? Why we want to analyze developer branch? Because we wan to provide quick feedback to developers. We merge from developer to master branch one per day. We don’t use git as branch per feature but only dev branch and master branch. Is there any chance? In TFVC we have this model too so we analyze dev branch to provide quick feedback to developer.

(Adrie den Blanken) #23

Hi, After installing the community versie 7.3 of SonarQube I got the same (following) problem with branches in TFS MSBuild integration (Note: I am not using GIT):

“Validation of project reactor failed: o To use the property “”, the branch plugin is required but not installed.”

Now I am a little bit lost in the information. Is there a way to solve this problem, or do I have to go back to versie 6.7.5?

Hope someone can help me?

SonarQube 7.3 Released
(Nicolas Bontoux) #24

Hi @Zefek,

Putting VSTS integration aside, yes you could virtually analyze another branch than master and pretend to SonarQube that that’s the main branch (you could even rename it in SQ settings from master to the actual name) bu not setting any

The trick here is in the context of VSTS task:

Based on current implementation, I’m not sure that’s a possibility:

@Julien_HENRY is currently away, but I’ll defer to him for confirming these observations, and hope fully we can plan some improvements.

(Nicolas Bontoux) #25

Hi @Adrie,

If you came directly from 6.7.5 then the behaviour you’re observing might not directly relate to 7.3 changes, but more to evolutions in 7.2 (with the advent of SonarQube Pull-Request support). I suggest you first verify the following:

(Julien Henry) #27

The strategy is indeed to consider that ALM default branch = SonarQube main branch.

We have considered making the behavior configurable, but we were not sure it was needed. Maybe we should reconsider? Like having a field on the prepare task where users can set the name of the branch that should be considered as the SQ main branch (and by default, it would be the ALM default branch). @Chris WDYT?