Branch detection doesn't work - SonarCloud with Bitbucket (Pipelines)

Hi !!

We are testing the 14 day Trial with SonarCloud (Developer Edition). We have a PHP project in Bitbucket, and we have configured Bitbucket to integrate it with Sonarcloud through Pipeline.

The configuration file (bitbucket-pipelines.yml) is the following:


image: node:6.9.4

clone:
  depth: full

pipelines:
  default:
    - step:
        caches:
          - node
          - sonarcloud
          - node-scanner
        script: 
          - npm install -g sonarqube-scanner
          - sonar-scanner -Dsonar.projectKey="XXXXX" -Dsonar.organization="YYYY" -Dsonar.projectName="TESt" -Dsonar.sources=custom -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$TOKEN -X

definitions:
  caches:
    sonarcloud: ~/.sonar/cache
    node-scanner: ~/.sonar/native-sonar-scanner

When we commit, it runs automatically, this is OK. We have configured the following branch pattern for that project: (master|develop|branch-).*

But when we commit in the develop branch, the branch is not created, but it analyzes the commit ALWAYS in the master branch!!

We have tested with the regular expression by default, creating a branch called “branch-test” and it does not work either.

The following appears in the bitbucket pipeline log:

11:23:48.829 INFO: Load project branches
11:23:48.921 DEBUG: GET 200 https://sonarcloud.io/api/project_branches/list?project="XXXX" | time=92ms
11:23:48.928 INFO: Load project branches (done) | time=99ms
11:23:48.929 INFO: Load project pull requests
11:23:49.020 DEBUG: GET 200 https://sonarcloud.io/api/project_pull_requests/list?project="XXXX" | time=91ms
11:23:49.024 INFO: Load project pull requests (done) | time=95ms
11:23:49.024 INFO: Load branch configuration
11:23:49.118 DEBUG: GET 400 https://sonarcloud.io/integration/bitbucketcloud/branch_info?project="XXXX"&owner=%7B______%7D&repo=%7B______%7D&branchName=develop | time=92ms
11:23:49.124 WARN: Could not fetch Bitbucket branch info
org.sonar.api.utils.MessageException: SonarCloud app not installed for '{______}'

("______" is a private GUID generated)

What is the problem?

Thanks!!

Regads, Rubén Recacha.

Hi,

Do you confirm you’re using BitBucket Cloud ? If so then before anything I think it’s worth re-sharing two top resources on this:

Cross-check the above and let us know if it helps improve the situation.

1 Like

Hi @NicoB

The problem was resolved. I downloaded the SonarCloud app in my bitbucket account.

Thank you !!

1 Like