Automatically populate your Source branch when publishing to Sonar
When you enable your build definition to trigger on multiple branches, you may not want them all to publish into the same Sonar project.
Sonar has the concept of Branches, they’re simply appended to the Project Key with a
-. This prevents an old Hotfix build from messing up the trend information of your current development. It also helps you configure different baselines for older versions (branches).
When building from the Visual Studio Team Services Build tasks you can configure the branch automatically by including the Build.SourceBranchName variable in your Project Key:
Some background on the values assigned to this variable can be found on the Visual Studio Team Build Variables documention:
The name of the branch the build was queued for.