SonarCloud analysis failed - Killed sonar-scanner

Hi all,

I’m trying to perform a Sonar Cloud validation in my code using Bitbucket pipeline, but I’m getting the error message bellow:

19:28:05.203 DEBUG: 'env/lib/python3.6/site-packages/pandas/tests/scalar/period/' generated metadata with charset 'UTF-8'
/usr/bin/ line 24:    11 Killed                  sonar-scanner "${ALL_ARGS[@]}" 2>&1
        12 Done                    | tee "${SCANNER_REPORT}"
e[31m SonarCloud analysis failed.e[0m

I tried to increase docker and step memory using the size: 2x and using parameter SONAR_SCANNER_OPTS="-Xmx2048m", but I still receive the same error message.

Please, could you help me?

I’m using the following script in bitbucket-pipelines.yml:

image: python:3.7.2 # Choose an image matching your project needs

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

          memory: 2048
            sonar: ~/.sonar/cache  # Caching SonarCloud artifacts will speed up your build
      - step: &build-test-sonarcloud
              name: Build, test and analyze on SonarCloud
              size: 2x
              -            # See
              - sonar
              -            # Build your project and run
              - pipe: sonarsource/sonarcloud-scan:1.2.0
                  DEBUG: 'true'
      - step: &check-quality-gate-sonarcloud
              name: Check the Quality Gate on SonarCloud
              size: 2x
              - pipe: sonarsource/sonarcloud-quality-gate:0.1.3
                  DEBUG: 'true'

pipelines:                 # More info here:
      - step: *build-test-sonarcloud
      - step: *check-quality-gate-sonarcloud
      - step: *build-test-sonarcloud
      - step: *check-quality-gate-sonarcloud

Full Log with Debug: pipelineLog-7.txt (3.9 MB)

  • ALM: Bitbucket Cloud
  • CI system: Bitbucket Cloud
  • Languages: Python
  • Potential workaround: Increase memory (it didn’t work)

Thank You!

Hi, sorry for the late reply.

This looks like a good measure, but I don’t see this neither in your pipeline nor in the log output. Can you share how you set this in the pipeline, and the corresponding log output?

A small note: I see you used size: 2x for the check-quality-gate-sonarcloud step too, this is unnecessary. This step is very light-weight, a low-spec machine will be perfectly enough for this.

Hi @janos
Thank you for reply.

I configured this parameter in Bitbucket Interface:

Is there another way to set it?

Thank you again!

Yes! What you tried doesn’t work the way you think. In general, the variables defined in the pipe configuration can be referenced in the bitbucket-pipelines.yml file. These variables are normally not passed directly to the pipe.

To pass that value to the pipe, you need to write the variables section like this in the bitbucket-pipelines.yml file:

    DEBUG: 'true'
    # or the value directly: SONAR_SCANNER_OPTS: -Xmx2048m

A post was split to a new topic: Sonar-scanner killed when analyzing large .sql file with 100k+ LOC