Sonar Scan fails, Bitbucket cloud showing Login screen

So this is a strange situation happening, I do use SonarCloud in a lot of projects, but in this particular client something is not right with the integration.

We are using BitBucket Cloud and the integration worked the day we set it up. But now, the plugin page just shows a Login screen, and you cannot do anything (it will error out with a 401 and a {"errors":[{"msg":"Authentication is required"}]}).
Tried with multiple browsers, cognito, clearing everything, and of course no ads blockers (now you know I’m used to SonarCloud).

Now, beside this situation the project is being scanned and reports are being generated for all branches you commit code.

The big issue starts when you do a PR. The first scan of the PR is done successfully and you can see the report in BitBucket Cloud. But if you try adding a new commit to that PR, an error will happen in the scan:

INFO: Auto-configuring pull request 4
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 26.289s
INFO: Final Memory: 7M/30M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
ERROR: Parameter 'sonar.pullrequest.branch' is mandatory for a pull request analysis
ERROR: 
The SonarQube Scanner did not complete successfully
01:11:28.046  Post-processing failed. Exit code: 1

There is no real issue with the setup of the project so this particular issue is a complete unknown to me.

Hope this helps to troubleshoot.

1 Like

Welcome to the community, and thanks for being a faithful user :slight_smile:

Do you think this is the same issue as reported in this other thread?

Just to clarify, does this happen only to the one project where the plugin page now shows login, or other projects too?

Hi Janos!

Yep same issue than the other thread.

For this client I only have one BitBucket project, so I cannot compare with another one. But the answer is yes same repo has both issues.

Please tell us how you run the scanner.

  • Are you using Bitbucket Cloud pipelines? Can you share a snippet of the YML file?
  • Or another CI? Which one? What is the complete scanner command used for a PR analysis?

We are using Circle CI
Here the command: (Please remember I’m using the same thing in a couple of different clients with no issues). This means the problem should be in the Sonar/BB integration.

dotnet sonarscanner begin
/k:REDACTED
/o:REDACTED
/d:sonar.login=REDACTED
/d:sonar.host.url=https://sonarcloud.io
/d:sonar.cs.opencover.reportsPaths=coverage.opencover.xml
dotnet build

dotnet sonarscanner end /d:sonar.login=REDACTED