Hi
We are using Github Action for our CI workflows and one of the steps includes SonarCloud scanner using sonarqube.
we have a wierd situation while once the status check of SonarCloud just suck on waiting to be reported although everything seems to be analyzed properly.
basically, when triggering a CI i see the following:
- sonarqube step ended successfully (pipeline-sonar status check)
- on SonarCloud UI i see the pr was analyzed successfully
- i also view the ‘Background Tasks’ on this repository and saw the Successful operation for this specific PR.
- i do see link for “view the PR” on the SonarCloud UI for this PR which redirect me to the PR on github
- we do have sonarcloud bot comment regarding the succesfull analysis (“Kudos, SonarCloud Quality Gate passed!”)
- but still the Status check for the Analysis stuck on waiting for status to be reported.
the main problem , is that it sometimes helps to retrigger the workflow, and sometimes its just works :
so i cant explain why its happening and not sure where to dig more.
i’ve reviewed few other tickets regarding this but none of them included solution for us.
when searching on the web for related issues i’ve noticed a comment about the fact that SonarCloud annotate PR based on the Sha1 in the working tree.
so i’ve reviewed our CI process and saw that when we use the default action of checking out the PR, it ends up with merge commit. so started to think that maybe this cause the PR not to be annotated cause this merge commit and the branch specific commit are not the same.
so i’ve updated our CI to checkout pull request HEAD commit instead of merge commit.
like the following:
- if: github.event_name == 'pull_request'
name: Checkout PR
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
this looks like solved the problem week ago and all the PR got annotated as we expected them to be.
ugly but…what can you do. this last for a week.
problem with SonarCloud started again yesterday. suddenly all sonarCloud steps includes the following message:
“Could not find ref: master in refs/heads, refs/remotes/upstream or refs/remotes/origin”
that’s make sense as we only fetch the exact commit of the PR, but now it only started to yell about it now?
anyway i’ve updated our CI to includes all history so it will have this ref of master also.
- if: github.event_name == 'pull_request'
name: Checkout PR
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
it solved the issue for one PR but again on other PRs i still see this instability again, where PR got analyzed on the Sonar but the status on the PR stuck on “waiting for status to be reported”.
what’s going on?
what am i missing here?
thanks!