Setting sonar.projectBaseDir works differently in SonarCloudPrepare@3 than in SonarCloudPrepare@2

Hello @simo-esko ,

After some investigation and thanks to your logs, I could notice that Azure DevOps automatically converts the value of cliSources to an absolute path relative to the root folder (instead of forwarding the value as-is to the Scanner CLI), because we mark it in our task configuration as being a path.

So when you set src\react\React.Web in cliSources, what our task sees is E:\agent_work\7\s\src/react/React.Web.

You have multiple workarounds to this:

  • Do not set cliSources and instead define sonar.sources in the extraProperties as a relative path
  • Set cliSources as an absolute path already (so, starting from your sonarProjectBaseDir).

I’ve created a ticket SONARAZDO-440 which you can track to follow our progress on this, as we will likely want to workaround this Azure behavior.

2 Likes