QualityGate can't find sonarcloud-scan.log (C# project)

Hi,

we are using SonarCloud and CI/CD Bitbucket pipeline on a C# project.
The scanner is working fine but we have a problem running the QualityGate afterwards.
The QualityGate can’t find the scanned results.

This is our pipeline:

              - export PATH="$PATH:/root/.dotnet/tools"
              - dotnet tool install --global dotnet-sonarscanner
              - dotnet sonarscanner begin /k:"XXXXX" /d:"sonar.login=${SONAR_TOKEN}" /o:"XXXXX" /v:"${BITBUCKET_COMMIT}" /d:"sonar.host.url=https://sonarcloud.io"
              - dotnet build hrAPI.sln
              - dotnet sonarscanner end /d:"sonar.login=${SONAR_TOKEN}"
              - pipe: sonarsource/sonarcloud-quality-gate:0.1.6

And this is the error message:

✖ Quality Gate failed: Could not get scanner report: [Errno 2] No such file or directory: '/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/sonarsource/sonarcloud-scan/sonarcloud-scan.log'

Thanks for any advice.

Hey there.

Using sonarsource/sonarcloud-quality-gate requires the use of the sonarsource/sonarcloud-scan pipe… which cannot be used for analyzing C# projects.

It is still possible to fail the pipeline based on the Quality Gate, adding the analysis parameter sonar.qualitygate.wait=true to the end command.

- dotnet sonarscanner end /d:"sonar.login=${SONAR_TOKEN}" /d:"sonar.qualitygate.wait=true"

(I also wish we had better guidance for C# + Bitbucket Pipelines, and I’ll add this thread to my list of examples internally :slight_smile:)

1 Like

Hi Colin,

thank you very much for solving our issue :slight_smile:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.