SonarCloud BitBucket PRs are not appearing from the very beginning

From the point I added first project to my org, I cannot see pull requests analized separately, though all other information is present there. Screenshot attached.


No errors. There was a quality gate check error first time when I added sonar and created pr, but then it started to work fine
in logs I see(not sure if its related)
INFO: Load project pull requests
INFO: Load project pull requests (done) | time=235ms

On pr page it says:

Code Quality:
Not analyzed on SonarCloud yet…

No widget is shown either
The end of scanner logs:
ANALYSIS SUCCESSFUL, you can find the results at: https://sonarcloud.io/dashboard?id=myProjectKey. No &branch or &pullRequest in url for merge and pr

Can you please help/suggests what the issue can be? Since I have tried everything I know. Thanks in advance

clone:
  depth: full
definitions:
  caches:
    sonar: .sonar/cache
  scripts:
    - script: &setup-env-vars
        |
        [ -f './env_vars' ] && cat ./env_vars && source ./env_vars;
  steps:
    - step: &sonarcloud-scanner
        name: sonarcloud-scanner
        clone:
          depth: full
        caches:
          - sonar
        script:
          - pipe: sonarsource/sonarcloud-scan:2.0.0
            variables:
              EXTRA_ARGS: >
                -Dsonar.projectKey=my_project
                -Dsonar.organization=my_org
                -Dsonar.sources=py_modules
                -Dsonar.host.url=https://sonarcloud.io
                -Dsonar.exclusions=py_modules/**/tests/**
    - step: &sonarcloud-quality-gate-check
        name: sonarcloud-quality-gate-check
        script:
          - pipe: sonarsource/sonarcloud-quality-gate:0.1.6

pipelines:
  pull-requests:
    '**':
      - step:
          <<: *sonarcloud-scanner
#          condition:
#            changesets:
#              includePaths:
#                - 'py_modules/**'
      - step:
          <<: *sonarcloud-quality-gate-check
#          condition:
#            changesets:
#              includePaths:
#                - 'py_modules/**'
  branches:
    main:
      - step:
          <<: *setup-vars
      - step:
          <<: *sonarcloud-scanner
#          condition:
#            changesets:
#              includePaths:
#                - 'py_modules/**'
      - step:
          <<: *sonarcloud-quality-gate-check
#          condition:
#            changesets:
#              includePaths:
#                - 'py_modules/**'

  • ALM used Bitbucket Cloud
  • CI system used Bitbucket Cloud
  • Languages of the repository python, docker

I have solved the issue.
Changed pipelines to do it in more “manual manner”

image: atlassian/default-image

clone:
  depth: full              # SonarCloud scanner needs the full history to assign issues properly

definitions:
  caches:
    sonar: ~/.sonar/cache  # Caching SonarCloud artifacts will speed up your build
  steps:
    - step: &build-test-sonarcloud
        name: Build, test and analyze on SonarCloud
        image: sonarsource/sonar-scanner-cli
        caches:
          - sonar
        services:
          - docker
        script:
          #- pipe: sonarsource/sonarcloud-scan:2.0.0
          - echo "sonar.pullrequest.branch=$BITBUCKET_BRANCH" >> sonar-project.properties
          - echo "sonar.pullrequest.base=$BITBUCKET_PR_DESTINATION_BRANCH" >> sonar-project.properties
          - echo "sonar.pullrequest.key=$BITBUCKET_PR_ID" >> sonar-project.properties
          - echo "sonar-project.properties values:"
          - cat sonar-project.properties
          - export SONAR_SCANLOG_PATH="${BITBUCKET_CLONE_DIR}/.bitbucket/pipelines/generated/pipeline/pipes/sonarsource/sonarcloud-scan"
          - mkdir -p "$SONAR_SCANLOG_PATH"
          - sonar-scanner 2>&1 | tee "${SONAR_SCANLOG_PATH}/sonarcloud-scan.log"
        artifacts:
          - .bitbucket/pipelines/generated/pipeline/pipes/**
    - step: &check-quality-gate-sonarcloud
        name: Check the Quality Gate on SonarCloud
        script:
          - pipe: sonarsource/sonarcloud-quality-gate:0.1.6

pipelines:                 # More info here: https://confluence.atlassian.com/bitbucket/configure-bitbucket-pipelines-yml-792298910.html
  branches:
    master:
#      - step: *build-test-sonarcloud
 #     - step: *check-quality-gate-sonarcloud
  pull-requests:
    '**':
      - step: *build-test-sonarcloud
      - step: *check-quality-gate-sonarcloud

but I am sure that was not what helped, since I have done another thing at the same time: created a new project WITH THE DIFFERENT name(by default its uses reponame)

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.