SonarScanner for .NET - split scan into multiple CI jobs

I’m using SonarScanner for .NET to perform code quality analysis and to gather coverage data.

Currently both of the above processes including the begin and end steps are performed in a single CI job that takes quite a while (cumulative cost of building project, test project, running tests and Sonar scan overhead). This leaves me with 2 options:

  1. Wait for the single big job to complete to export the build output and reuse it in subsequent jobs
  2. Perform build step in a separate parallel job (quicker than the big job) and run other jobs that depend on the build output after it

I don’t like any of the above 2 options as I either have to:

  1. pay by having a CI workflow with slower feedback cycle
  2. pay by spending more CI minutes ($$$) by having to build the source code twice

My question is following - is it possible to split the SonarScanner for .NET execution into multiple jobs as follows:

  • Job 1: dotnet sonarscanner begin + dotnet build
  • Job 2: <outputs of Job 1> + dotnet test + dotnet sonarscanner end
    ?

If that is possible, which system paths do I need to preserve between Job 1 and Job 2 so that the scan started by the first job can be completed by the second job?

Hi @Ivan_Ribakov

I know we have chatted directly about this, but for the sake of other people coming to this thread, this is not possible at this time.

the “end step” relies on output of the begin step and of the build step that is not public and subject to change without notice, and I would not attempt this if I were you.

Denis.

1 Like