The organization I work for is experiencing a problem with our integration with GitHub. In some cases, the analysis status is not being sent back, and as we have a check against it, our Pull Requests are being blocked by that. It is an intermittent problem. I can see on SonarCloud that the analysis was successful; I can see a message sent to GitHub, as the PR has a comment from SonarCloud saying that the Quality Gate passed. Still, the “SonarCloud Code Analysis Expected — Waiting for status to be reported” is never cleared on checks.
This happens from time to time. Sometimes if you trigger the build again, it will be cleared, but this seems to become more common every day, and we need a solution for that. So how can we get support to have this analyzed and fixed?
In my case, my organization is facing a similar issue and the workaround that we tried is merging the latest master again and again into the branch and build it again.
For now it’s pretty hard to observe what’s the issue for lack of logs.
So when you have a recent PR that shows this issue, please, report to us so we can take a look to the logs and see if anything went wrong. Without these logs we are kinda blind.
Welcome to the community, @Navsheen! Do you have any recent PR where you observed this issue?
I’ve been investigating the issue with the help of my colleagues, specially about the PR-3554. We could pin point this PR in our logs and investigate a bit the possible causes of the problem.
So, in short, the job that gives the status check to commits failed with a status 422. After further investigation from my colleagues, we found out that this error happens when our back-end fails to find the commit related to that check. And this might happen for many reasons, for example, when the history changes, or when the check is ran on a merge commit (where commits are squashed), or things like that.
That said, I would like to know from you if you find a specific commit on your code base: 51ffde2ee3a8c8e3bb1a7af91b0d5bbd9db31d51. This is the commit that was expected to be given the status check, but was not found.
Another question for you, do you have on your CI any Git manipulation mechanism that could lead to lost commits, somehow? I don’t mean that the problem is on your workflow, but I just want to understand what could lead to a missing commit error.
I couldn’t find this commit in my main branch, as it was a commit in the branch that originated the PR. Below you can see the build from Jenkins, with that same SHA that you shared. When the PR is merged, our policy is to use squash merge and delete the branch.
I don’t know how/why it didn’t find this specific commit to report the status back, as this branch/PR stayed open for a while after that, and at least three more builds happen to it after that.
To your question, no, our CI doesn’t manipulate the changes.
I’ve been investigating your issue a lot in the past few days.
And with your last message we were able to build some possible scenarios where this could happen. I’m not sure if this is the case of these PRs you sent me, though.
One scenario that could trigger that is a PR with 2 commits. During the Analysis of the last commit, you squash locally and force push the branch. In theory, the analysis of the last commit (which doesn’t exist anymore) should be stopped. If this doesn’t happen, this issue might happen. Do you know if this might happen in the lifecycle of your branches?
Check the solution for the thread. Is your pipeline using the same technique to get the revision to be analysed?
I think we are very close to find out what’s going on. For now I will unassign this thread, and if you still have issues after applying the recommendation, feel free to ping here again.