Quality Gate failed: Could not get scanner report: [Errno 2] No such file or directory: '/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/sonarsource/sonarcloud-scan/sonarcloud-scan.log'

Pipeline I am using

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: openjdk:8
        caches:
          - gradle
          - sonar
        script: # Modify the commands below to build your repository.
        # You must commit the Gradle wrapper to your repository
        # https://docs.gradle.org/current/userguide/gradle_wrapper.html
          - ./gradlew -x test build sonarqube -Partifactory_user=$ARTIFACTORY_ACCOUNT_USR -Partifactory_password=$ARTIFACTORY_ACCOUNT_PSW -PapiToken=$ARTIFACTORY_TOKEN
        variables:
          DEBUG: true
        size: 2x # Double resources available for this step.
        artifacts:
          - build/libs/**
    - step: &check-quality-gate-sonarcloud
        name: Check the Quality Gate on SonarCloud
        script:
          - pipe: sonarsource/sonarcloud-quality-gate:0.1.3

pipelines:
  branches:
    '**':
      - step: *build-test-sonarcloud
      - step: *check-quality-gate-sonarcloud
    pull-requests:
      '**':
        - step: *build-test-sonarcloud
        - step: *check-quality-gate-sonarcloud

Hi,

We are using BitBucket Pipelines too.

Below is our bitbucket-pipelines.yml:

clone:
      depth: full

definitions:
      caches:
            sonar: ~/.sonar/cache
      steps:
      - step: &build-test-sonarcloud
              name: Build, test and analyze on SonarCloud
              caches:
              - sonar
              script:
              - pipe: sonarsource/sonarcloud-scan:1.0.1
      - step: &check-quality-gate-sonarcloud
              name: Check the Quality Gate on SonarCloud
              script:
              - pipe: sonarsource/sonarcloud-quality-gate:0.1.3

pipelines:
  branches:
    master:
      - step: *build-test-sonarcloud
      - step: *check-quality-gate-sonarcloud
  pull-requests:
    '**':
      - step: *build-test-sonarcloud
      - step: *check-quality-gate-sonarcloud

In step &build-test-sonarcloud, you’re missing the line - pipe: sonarsource/sonarcloud-scan:1.0.1 under script.

This may be the issue.

Hi shasank,

You are right if it is not maven or Gradle,

For maven and Gradle builds we have to the way mentioned in my pipeline

Thanks

Sundeep

As far as I know we have to do the Maven/Gradle step, and then the - pipe: sonarsource/sonarcloud-scan:1.0.1 step.

As are doing the same for a Heroku Git scenario.

I followed this https://bitbucket.org/sonarsource/sample-gradle-project/src/master/

https://bitbucket.org/sonarsource/sonarcloud-scan/src/master/README.md for sonar-scan

I will try what you said too

1 Like