highbyte / sonarscan-dotnet

GitHub Action SonarCloud/SonarQube scanner for .NET 8/7/6/5 and .NET Core applications with pull request decoration support
https://github.com/marketplace/actions/sonarscan-dotnet
MIT License
36 stars 24 forks source link

How to provide the project base directory for sonar scan as we have multiple backend services in the same repo #33

Closed chaisri-bh closed 2 months ago

chaisri-bh commented 3 months ago

I have integrated the sonar scan in our build pipeline. But the repo we are using have multiple backend services in the same repo. when i trigger the sonar scan it cannot able to find the .sln file as it will be available in the nested repo of the backend service.

how can i provide the project base directory path to run the scan

Github Action input parameters INPUT_SONARPROJECTKEY: *-*** INPUT_SONARPROJECTNAME: -* INPUT_SONARORGANIZATION: INPUT_DOTNETPREBUILDCMD: INPUT_DOTNETBUILDARGUMENTS: INPUT_DOTNETTESTARGUMENTS: INPUT_DOTNETDISABLETESTS: INPUT_SONARBEGINARGUMENTS: INPUT_SONARHOSTNAME:

i want to provide the specific path of the backend service to run the scan. which is available in sonar scan github action projectBaseDir: App/*/**/****

highbyte commented 3 months ago

The scan works on single .sln or .csproj file. The scan invokes the dotnet SDK dotnet build command and appends whatever you specify in dotnetBuildArguments parameter.

If you have sub-folder with a single .sln or .csproj file you can specify the folder like in this example: https://github.com/highbyte/sonarscan-dotnet?tab=readme-ov-file#build-subfolder-src-and-include-code-coverage

Or if you want to specify a specific .sln (or .csproj) file in a sub-folder you use it like this: dotnetBuildArguments: ./myfolder/mysolution.sln

chaisri-bh commented 2 months ago

thank you. you can close it now