Sonarcloud publish is not working Expected — Waiting for status to be reported

We are using circleci with sonarcloud for our open source repositories, but sometimes we are facing this issue sonacloud analysis is completed that we can see in circleci step and it is also publish result to sonarcloud but in github PR status is shows Soncloud Expected — Waiting for status to be reported. Because of this, it is not allowing us to merge the PR since the check we have enabled the sonarcloud check in github.
Is this is a bug or are we missing anything?

Hello @harshavardhanc,

Do you think that the problem described in this comment could be the cause of your problem?

The scanner reads the environment variables set by CircleCI to either trigger branch or PR analysis. If CircleCI starts a build following a commit on a branch, and there is not yet a pull request open for that branch, then there will not be any environment variables that are related to a pullrequest availablein the build, so we will trigger a regular branch analysis.

@TomVanBraband Sorry for the delay, Not sure this is exactly the issue. But after going through same issue in this forum we have disabled the CircleCI check in github. After that it seems working fine. Didn’t understand was the issue which we were facing it was because of that check or not.
Can you please me understanding about it.

Hello @harshavardhanc,

I suspect that the problem is that CircleCI does not trigger a pipeline whenever a pull request is opened on Github.

If you push a commit to a branch on Github, CircleCI will trigger a pipeline which will then trigger a SonarCloud analysis on that branch. If you open a pull request for that branch afterwards, there will be no new CircleCI pipeline triggered, and therefore there will be no SonarCloud analysis of the pull request. The SonarCloud check will therefore not be satisfied.

If you push changes to an already open pull request, CircleCI will detect that there is a pull request open for that commit. In that case the SonarCloud analysis will run on the pull request, and it will satisfy the SonarCloud check on the PR.

Hope that is clear, let me know if you have any more questions.
Tom

1 Like

Thanks a ton for the clarification @TomVanBraband. Exactly this was the issue, understood the workflow now.