PR analysis shows no code on one specific long-lived branch

We have a CI pipeline analysing our PRs. The same pipeline runs on all branches. Our release/x.xxx branches report everything perfectly and SonarCloud works great. However, on our branch named “integration”, our code tab displays “no results”, our Measures tab displays “No coverage measures.”, and our Issues tab is, unsurprisingly, also empty.

The scanner runs perfectly and the reports coming from the scanner appear to be correct. If I scan a branch with sonar.pullrequest.base=release/x.xxx, the PR analysis page is populated, but then if I run the scanner again with sonar.pullrequest.base=integration, the PR analysis page is blank. The logs from both scans are identical (apart from the base branch). In both cases, the background task is successful and the context appears to be identical.

Integration is our main branch and is in our long lived branches pattern. Branch analysis works fine on it - it’s just incoming PRs that don’t work.

Anyone got any ideas as to why this might be happening?

I’m not really sure I understand perfectly your situation, so let’s start with the following statement:

You say that “integration” is your main branch: is that what you see when you go on the “Branch & Pull Request” administration page?
Second, how do you trigger analyses for this branch? (i.e. which parameters do you pass?)

Thank you for getting back to me!

I should start by rewording part of my issue:

PRs to our release/x.xxx branches report everything perfectly and SonarCloud works great. However, on PRs to our branch named “integration”, our code tab displays “no results”, our Measures tab displays “No coverage measures.”, and our Issues tab is, unsurprisingly, also empty.

Yes, integration is our main branch, and that’s what we see on the “Branch & Pull Requests” admin page.

Analysis of the integration and release branches are run with
/tmp/sonar/sonar-scanner-3.2.0.1227-linux/bin/sonar-scanner -Dsonar.login=${SONAR_LOGIN} -Dsonar.branch.name=${CIRCLE_BRANCH}

PRs to these branches are run with
/tmp/sonar/sonar-scanner-3.2.0.1227-linux/bin/sonar-scanner -Dsonar.login=${SONAR_LOGIN} -Dsonar.pullrequest.branch=${CIRCLE_BRANCH} -Dsonar.pullrequest.key=${PR_NUMBER} -Dsonar.pullrequest.base=$TARGET_BRANCH

All these variables appear to evaluate correctly.

For clarity:

  • Analysis of the release/x.xxxx branch works
  • Analysis of the integration branch works
  • Analysis of PRs to release/x.xxxx work
  • Analysis of PRs to integration fail

We have the following keys in our sonar-project.properties file (redacted where I don’t believe it could be relevant):

sonar.host.url=https://sonarcloud.io
sonar.projectKey=xxx
sonar.organization=xxx

sonar.sources=.
sonar.python.coverage.reportPath=coverage.xml

sonar.pullrequest.provider=github
sonar.pullrequest.github.endpoint=https://api.github.com/
sonar.pullrequest.github.repository=xxx

We’ve also tried this using a branch named master (containing the same code), and we’re experiencing the same issues.

Hi,

Unfortunately I am also experiencing the same problem.
I would really like to use your service but it does not seam to be working as expected, can someone give some suggestions on what we can try to make it work?

Would be a shame to have to chose another service provider. =/

Cheers,

Mac, sorry for the late reply.

I’ve looked through the forum, and it looks like there are other users facing a very similar issue:

As you will notice, they are also on Circle CI, and it looks like this behaviour is due to a bug on Circle CI. @dmeneses reported this bug, and also suggested a workaround that you may want to try (you will probably need to replace master by integration):

Hopefully this will help.

1 Like

That was it! Fantastic. Thank you Fabrice!

1 Like