SonarCloud/Quality Gate Stuck in Waiting

  • ALM used - Azure DevOps Services
  • CI system used - Azure DevOps Services
  • Scanner command used when applicable - VS/MSBuild
  • Error observed - When setting up SonarCloud PR Decoration within Azure DevOps Services, the scans will complete and whether the quality gate passes or fails, the pull request is stuck on the ‘SonarCloud/quality gate’ check.
    image
  1. Correct Status Check is added to branch policies
    image
  2. PATs between Azure DevOps and SonarCloud have been updated multiple times with an account that has sufficient permissions. Sonar PAT added to ADO side and ADO (Code - Read/Write) token added to SonarCloud configuration.

This appears to be a common issue, but continues to occur at random times.

Is there a planned fix for this that will remain?

Hi Preston,

Would you mind sharing your pipeline (possibly redacting sensitive information)?

Denis

Steps:



image

Jobs:
image

Pipeline:

Main branch policies:

Within the steps, I am calling scripts that set the Provider and VSTS token to the proper values generated from SonarCloud

Hi !

We are experiencing a similar problem, where sonar gives us a 100% coverage

But then the quality gate is not being shown as green.

And all the pipeline steps run without any error / issue
image

FYI We had a similar issue ( diff was that it used to be always failing as now seems more random )
a few months back

@denis.troller , have there been any sort of status updates for this issue? I provided my pipeline below as requested.

Hi Preston,

Sorry for not coming back to you more quickly!
As an experiment, could you remove the sonarcloud-buildbreaker task from your pipeline and see if it improves things? We have had issues in the past with it, so it would be good to rule it out first.

Denis

@denis.troller , even after removing that step from the pipeline, it continues to hang
image

Would you mind sharing the output of the pipeline run?

@denis.troller , I would need to redact the log first before I can send it over as it has a bit of personal creds and code in it. What information are you looking for specifcally?

I do not know exactly what I am looking for at this point, it’s more to understand what could be going on here. Please do redact sensitive information in it.

@denis.troller , do you need anything in regards to the actual build process itself? This log is 45k+ lines long and probably 75% of it is tied to just the build.

Are you okay with just the Sonar steps themselves?

@denis.troller , I have completed the redacting of the log, but my CISO requested that I contact you directly. Is there any way that you can provide an email address?

Hi, thanks for the logs. I have raised the issue with the proper team and will get back to you as soon as we have anything or if we require further enquiries.

Denis

@denis.troller , checking in on this to see if there are any updates from the team.

Please let me know.

Thank You,
Preston

@denis.troller , I am following up again as I have not heard any updates for bout 2 weeks now. Please let me know what the status is of this issue.

@denis.troller is someone still looking into this issue?

Hello @prketner,

Thank you for the logs and screenshot.

From what you are saying (the issue is intermittent), I can rule out the most basic reasons why your issue appears, but still could you double check that:

  1. Monorepo is disabled for your project

  2. The PAT is indeed set in the specific project where it’s needed?

  3. Your pipeline is set to run in Branch policy > Build Validation

  4. In the cases where you do not receive back the SonarCloud/quality gate, the pipeline is indeed executed

    Click “View 4 checks” on the first screenshot you sent to send it

Once you ensured all of the following, we can rule out all the basic reasons why it could not be working (monorepo setup, PAT not set in the project, pipeline not running for the specific pull request change).

If all the rest looks good, we will need to allocate a bit of time to dig into that with someone who has expertise on the specific part of the code that handles sending the quality gate status to Azure DevOps.

You state that the issue is intermittent, could you be more specific about how intermittent it is? Is it failing 10% of the time, 50%, 90%?

Hello @prketner , it’s been more than 2 months, I am assuming you found a resolution for your issue. If so, would you be willing to share it to help other users facing the same issue?
Cheers
Benjamin