The first part build-test-sonarcloud passes but then I get an error when trying to check the quality gate
Status: Downloaded newer image for sonarsource/sonarcloud-quality-gate:0.1.3
âś– Could not check Quality Gate status
I just started trying out SonarCloud so I am not sure what I am missing. I got it to work just fine with a normal C# repository and data/reports were uploaded just fine.
Have you checked the Quality Gate status of your project on SonarCloud? Is it possible that it has not been computed, because it’s the first scan of your project, or because you have not set the New Code period setting and are using the default “Sonar Way” quality gate?
If it is the case, I invite you to follow the New Code Definition documentation, to set up the period SonarCloud uses to check the “New Code” conditions of the Quality Gate for your project.
The setting will take effect during the next scan of your project, and the pipeline should be OK if it passes.
I just tried out with a different custom quality gate, and the build passed. However, my code does seem to be uploaded/analyzed in the portal. I believe this has to do with the submodule?
Is the issue fixed?
If not, we released a new version of the sonarcloud-quality-gate pipe, version 0.1.4, which bring support to “not computed” quality gates recently introduced in SonarCloud.
Could you please clarify what you mean by “my code does seem to be uploaded/analyzed in the portal”, and the problem with submodule?
The issue around the “Could not check quality gate” was fixed by changing the Quality Gate itself. I did work with both .14 and .13.
However, the code does not seem to be scanned. It does say scanning complete in bitbucket but in the SonarCloud portal, the repository is empty and no lines of code were analyzed.
Do you have some special configuration for the sonarsource/sonarcloud-scan pipe, or on SonarCloud side (Project administration > General Settings > Analysis Scope), that could exclude the source files from the analysis (here is the documentation about analysis scope configuration)?
Could you please post the logs of the sonarsource/sonarcloud-scan pipe execution?
Also, are there analysis warnings displayed at the top right corner of the SonarCloud project page?
Looking at the logs and at your demo project, it seems to me that the submodule is not cloned into its directory.
I tried locally, and after calling git submodule update --recursive --depth 100 the submodule directory was still empty.
But if I add this command before : git submodule init, then the update command actually clones the content into the directory.
Maybe updating your pipeline to add the git submodule init command before the git submodule update could solve?
Hi Claire, I added the following command but nothing changed. The build results are the same and the code/scan results are still not in the portal sadly.
I can now see this, but still, no lines analyzed.
I see an improvement : the code is shown in the “code” tab, while I think it was empty before.
So to me, the submodule issue is fixed.
For the measures and quality gate being empty, I see your code is C#.
C# code can’t be analyzed directly like this. It needs a special scanner, called Scanner for MSBuild.
From the scanner logs:
WARN: Your project contains C# files which cannot be analyzed with the scanner you are using. To analyze C# or VB.NET, you must use the Scanner for MSBuild 4.x
The documentation to configure the Scanner for MSBuild is here.