How to change `sonar.scanner.metadataFilePath`

Must-share information (formatted with Markdown):

which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

  • Lastest version of Azure Devops tasks: SonarQubePrepare@5, SonarQubeAnalyze@5, SonarQubePublish@5
  • SonarQube Version 9.7

what are you trying to achieve

The gold is to let SonarQubePublish find the report-task.txt where the file full path contains special charateers.

In Azure DevOps, the sonar report-task.txt full path contains the pipeline BuildNumber.

I have special charaters brackets [] in my BuildNumber, and I cannot remove it, because we have many pipeline name including [], it’s an entreprise naming convention. As per bug reported here and here, I would like to workaround it by change the value of sonar.scanner.metadataFilePath in order to prevent from using the default one which contains build name in the path, so with the special char [].

what have you tried so far to achieve this:

I tried following values like in the file sonar-project.properties or directly as extraProperties in SonarQubePrepare@5:

  • sonar.scanner.metadataFilePath=/home/vsts/work/_temp/sonar/test

or

  • sonar.scanner.metadataFilePath=test

but none of them worked.

BTW, I’m sure the config file path sonar-project.properties or extraProperties is good, because I have other sonar settings defined there that are working.

Hey @copdips ,

It seems like this property is not supported by SonarQubePrepare@5 task. It is always overridden as you can see here.

I have created a bug ticket to fix that issue and make that parameter configurable.

1 Like