In my pipeline I get the error: “task was not executed prior to this task” at the Analyze step in our pipeline.
It is complaining that the prepare step was not executed, even though it was.
From what I can see, it no idea that the previous step was run because it was part of previous job within the same pipeline.
How can the results from the Prepare Step be made visible to other (or all) parts of the pipeline later on ?
There needs to be done in this case, as the the code coverage (coberta) files are generated in a job after the build, and the Analyze needs those files to process the code coverage.
Flow looks like this:
job: build
Run Sonar Prepare
Do build
artifact generation , etc…
job: test
setup unit testing
run code coverage checks
Run Sonar Analyze
That last Analyze throws an error as it has no idea Prepare has run.
This is an interesting scenario, unfortunately, this is not supporter when using the Scanner for MSBuild.
What i would recommend is to put back the Run Sonar Analyze in the same “build” job (but after the test one), and, on the test, be able to publish back test coverage files to the build job, then you can pass the following Sonar property (depending on your setup) while executing the Scanner :
sonar.cs.vscoveragexml.reportsPaths
Path to Visual Studio Code Coverage report. Multiple paths may be comma-delimited, or included via wildcards. See Notes on importing .NET reports below.
sonar.cs.dotcover.reportsPaths
Path to dotCover coverage report. See Notes on importing .NET reports below.
sonar.cs.opencover.reportsPaths
Path to OpenCover coverage report. See Notes on importing .NET reports below.