I’m not sure I understand what you’re asking. I guess you want to isolate build from test, each with its own begin and end? If that’s what you’re after, I wouldn’t recommend it. begin essentially sets up a listening context, and causes the rules to be run as part of / during the build. The end step wraps up analysis and submits the analysis report to the server.
Run two different begin / end combinations on the same project and you’ll get two different half-analyses that continually overwrite each other because analysis is not additive. It all has to be part of the same analysis.
It was not thinking about pure isolation, sorry for my english. For me, the scanner begin and the scanner end actions are at the pipeline level
A block like beginstep and endstep are temporary listening/rules/analysis/… running during a job.
When all the jobs are done, the server would be able to “concat” the different reports and do a final one
For my better personal understanding, how does the scanner listen those 2 tasks below ?
test:
stage: test
script:
- dotnet sonarscanner begin
- dotnet build
- dotnet test
- dotnet sonarscanner end
Does it get all the output in one step ? The scanner does not see any difference between one line, two or three lines ?
Or does it parse the first command output dotnet build, then do internal things, and then parse the dotnet test output, finalize, and send all to the server ?
Again, the concatenation happens during the scanner run, not server-side. If you send multiple reports to the server, it won’t concatenate them; it will replace them.
You’re asking for the low-level, technical details? There’s a hint the the docs I linked. Did you check them?
To be honest, I’m not sure what changes are made to the test step. I suspect it’s just an order-of-operations requirement that puts the test step where it is in the sequence.
If you send multiple reports to the server, it won’t concatenate them; it will replace them.
That was the initial question. In theory could it be possible to concatenate instead of replace ?
That was all the idea behind the concept of beginstep and endstep. In theory, set a series of functions server-side that add data and not replace them. Then tell the server “ok no more data”, then the server digest everything and “voilà”! (again, just in theory, I can imagine the amount of work, of questions, problems, …)
Through the link you provided I read about the end command:
It […], collects the analysis data generated by the build, the test results, and the code coverage, and then uploads everything to SonarQube Server.
So I assume the scanner does separate task for each dotnetcommand ?
Sorry, this is going off-topic of a simple “suggest feature”