Sonarcloud detected files to be analyzed but failed to scan

We are trying to analyze our angular project but we’re getting this following error

I’m using the following pipes in my pipeline:

  • pipe: sonarsource/sonarcloud-scan:1.2.2
  • pipe: sonarsource/sonarcloud-quality-gate:0.1.4
  • ALM used Bitbucket Cloud

  • CI system used Bitbucket Cloud

  • Languages of the repository: Typescript

  • Error observed

+ docker container run \
   --volume=/opt/atlassian/pipelines/agent/build:/opt/atlassian/pipelines/agent/build \
   --volume=/opt/atlassian/pipelines/agent/ssh:/opt/atlassian/pipelines/agent/ssh:ro \
   --volume=/usr/local/bin/docker:/usr/local/bin/docker:ro \
   --volume=/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes:/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes \
   --volume=/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/sonarsource/sonarcloud-scan:/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/sonarsource/sonarcloud-scan \
   --workdir=$(pwd) \
   --label=org.bitbucket.pipelines.system=true \
   --env=BITBUCKET_STEP_TRIGGERER_UUID="$BITBUCKET_STEP_TRIGGERER_UUID" \
   --env=BITBUCKET_REPO_FULL_NAME="$BITBUCKET_REPO_FULL_NAME" \
   --env=BITBUCKET_GIT_HTTP_ORIGIN="$BITBUCKET_GIT_HTTP_ORIGIN" \
   --env=BITBUCKET_PROJECT_UUID="$BITBUCKET_PROJECT_UUID" \
   --env=BITBUCKET_REPO_IS_PRIVATE="$BITBUCKET_REPO_IS_PRIVATE" \
   --env=BITBUCKET_WORKSPACE="$BITBUCKET_WORKSPACE" \
   --env=BITBUCKET_PR_DESTINATION_COMMIT="$BITBUCKET_PR_DESTINATION_COMMIT" \
   --env=BITBUCKET_REPO_OWNER_UUID="$BITBUCKET_REPO_OWNER_UUID" \
   --env=BITBUCKET_BRANCH="$BITBUCKET_BRANCH" \
   --env=BITBUCKET_REPO_UUID="$BITBUCKET_REPO_UUID" \
   --env=BITBUCKET_PROJECT_KEY="$BITBUCKET_PROJECT_KEY" \
   --env=BITBUCKET_REPO_SLUG="$BITBUCKET_REPO_SLUG" \
   --env=CI="$CI" \
   --env=BITBUCKET_PR_ID="$BITBUCKET_PR_ID" \
   --env=BITBUCKET_REPO_OWNER="$BITBUCKET_REPO_OWNER" \
   --env=BITBUCKET_STEP_RUN_NUMBER="$BITBUCKET_STEP_RUN_NUMBER" \
   --env=BITBUCKET_BUILD_NUMBER="$BITBUCKET_BUILD_NUMBER" \
   --env=BITBUCKET_GIT_SSH_ORIGIN="$BITBUCKET_GIT_SSH_ORIGIN" \
   --env=BITBUCKET_PIPELINE_UUID="$BITBUCKET_PIPELINE_UUID" \
   --env=BITBUCKET_COMMIT="$BITBUCKET_COMMIT" \
   --env=BITBUCKET_PR_DESTINATION_BRANCH="$BITBUCKET_PR_DESTINATION_BRANCH" \
   --env=BITBUCKET_CLONE_DIR="$BITBUCKET_CLONE_DIR" \
   --env=PIPELINES_JWT_TOKEN="$PIPELINES_JWT_TOKEN" \
   --env=BITBUCKET_STEP_UUID="$BITBUCKET_STEP_UUID" \
   --env=BITBUCKET_DOCKER_HOST_INTERNAL="$BITBUCKET_DOCKER_HOST_INTERNAL" \
   --env=DOCKER_HOST="tcp://host.docker.internal:2375" \
   --env=BITBUCKET_PIPE_SHARED_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes" \
   --env=BITBUCKET_PIPE_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/sonarsource/sonarcloud-scan" \
   --env=SONAR_TOKEN="${SONAR_TOKEN}" \
   --add-host="host.docker.internal:$BITBUCKET_DOCKER_HOST_INTERNAL" \
   sonarsource/sonarcloud-scan:1.2.2
Unable to find image 'sonarsource/sonarcloud-scan:1.2.2' locally
1.2.2: Pulling from sonarsource/sonarcloud-scan
27833a3ba0a5: Pulling fs layer
16d944e3d00d: Pulling fs layer
6aaf465b8930: Pulling fs layer
0684138f4cb6: Pulling fs layer
67c4e741e688: Pulling fs layer
783178df3a0c: Pulling fs layer
c87480966579: Pulling fs layer
7d4ea4b0fa5e: Pulling fs layer
f8c88f5851bf: Pulling fs layer
85ca034e6be6: Pulling fs layer
586712281a90: Pulling fs layer
c87480966579: Waiting
7d4ea4b0fa5e: Waiting
f8c88f5851bf: Waiting
85ca034e6be6: Waiting
586712281a90: Waiting
0684138f4cb6: Waiting
67c4e741e688: Waiting
783178df3a0c: Waiting
16d944e3d00d: Verifying Checksum
16d944e3d00d: Download complete
6aaf465b8930: Verifying Checksum
6aaf465b8930: Download complete
0684138f4cb6: Verifying Checksum
0684138f4cb6: Download complete
27833a3ba0a5: Verifying Checksum
27833a3ba0a5: Download complete
67c4e741e688: Verifying Checksum
67c4e741e688: Download complete
7d4ea4b0fa5e: Verifying Checksum
7d4ea4b0fa5e: Download complete
c87480966579: Verifying Checksum
c87480966579: Download complete
85ca034e6be6: Verifying Checksum
85ca034e6be6: Download complete
783178df3a0c: Verifying Checksum
783178df3a0c: Download complete
f8c88f5851bf: Verifying Checksum
f8c88f5851bf: Download complete
586712281a90: Verifying Checksum
586712281a90: Download complete
27833a3ba0a5: Pull complete
16d944e3d00d: Pull complete
6aaf465b8930: Pull complete
0684138f4cb6: Pull complete
67c4e741e688: Pull complete
783178df3a0c: Pull complete
c87480966579: Pull complete
7d4ea4b0fa5e: Pull complete
f8c88f5851bf: Pull complete
85ca034e6be6: Pull complete
586712281a90: Pull complete
Digest: sha256:20c00e713b9c10b2139ffa56d72e4cf47495d44743f1391faf9a1ab128468b80
0684138f4cb6: Pulling fs layer
67c4e741e688: Pulling fs layer
783178df3a0c: Pulling fs layer
c87480966579: Pulling fs layer
7d4ea4b0fa5e: Pulling fs layer
f8c88f5851bf: Pulling fs layer
85ca034e6be6: Pulling fs layer
586712281a90: Pulling fs layer
c87480966579: Waiting
7d4ea4b0fa5e: Waiting
f8c88f5851bf: Waiting
85ca034e6be6: Waiting
586712281a90: Waiting
0684138f4cb6: Waiting
67c4e741e688: Waiting
783178df3a0c: Waiting
16d944e3d00d: Verifying Checksum
16d944e3d00d: Download complete
6aaf465b8930: Verifying Checksum
6aaf465b8930: Download complete
0684138f4cb6: Verifying Checksum
0684138f4cb6: Download complete
27833a3ba0a5: Verifying Checksum
27833a3ba0a5: Download complete
67c4e741e688: Verifying Checksum
67c4e741e688: Download complete
7d4ea4b0fa5e: Verifying Checksum
7d4ea4b0fa5e: Download complete
c87480966579: Verifying Checksum
c87480966579: Download complete
85ca034e6be6: Verifying Checksum
85ca034e6be6: Download complete
783178df3a0c: Verifying Checksum
783178df3a0c: Download complete
f8c88f5851bf: Verifying Checksum
f8c88f5851bf: Download complete
586712281a90: Verifying Checksum
586712281a90: Download complete
27833a3ba0a5: Pull complete
16d944e3d00d: Pull complete
6aaf465b8930: Pull complete
0684138f4cb6: Pull complete
67c4e741e688: Pull complete
783178df3a0c: Pull complete
c87480966579: Pull complete
7d4ea4b0fa5e: Pull complete
f8c88f5851bf: Pull complete
85ca034e6be6: Pull complete
586712281a90: Pull complete
Digest: sha256:20c00e713b9c10b2139ffa56d72e4cf47495d44743f1391faf9a1ab128468b80
Status: Downloaded newer image for sonarsource/sonarcloud-scan:1.2.2
INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarScanner 4.4.0.2170
INFO: Java 11.0.2 Oracle Corporation (64-bit)
INFO: Linux 5.4.92-flatcar amd64
INFO: Bitbucket Cloud Pipelines detected
INFO: User cache: /root/.sonar/cache
INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: Analyzing on SonarQube server 8.9.1
INFO: Default locale: "en", source code encoding: "UTF-8" (analysis is platform dependent)
INFO: Load global settings
INFO: Load global settings (done) | time=597ms
INFO: Server id: 1BD809FA-AWHW8ct9-T_TB3XqouNu
INFO: User cache: /root/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=146ms
INFO: Load/download plugins (done) | time=34152ms
INFO: Loaded core extensions: developer-scanner
INFO: Found an active CI vendor: 'Bitbucket Pipelines'
INFO: Detected project key 'Kites_Software_ebsfrontend' from 'Bitbucket Cloud Pipelines'
INFO: Detected organization key 'kites-software' from 'Bitbucket Cloud Pipelines'
INFO: Load project settings for component key: 'Kites_Software_ebsfrontend'
INFO: Load project settings for component key: 'Kites_Software_ebsfrontend' (done) | time=108ms
INFO: Process project properties
INFO: Execute project builders
INFO: Execute project builders (done) | time=1ms
INFO: Project key: Kites_Software_ebsfrontend
INFO: Base dir: /opt/atlassian/pipelines/agent/build
INFO: Working dir: /opt/atlassian/pipelines/agent/build/.scannerwork
INFO: Load project branches
INFO: Load project branches (done) | time=108ms
INFO: Check ALM binding of project 'Kites_Software_ebsfrontend'
INFO: Detected project binding: BOUND
INFO: Check ALM binding of project 'Kites_Software_ebsfrontend' (done) | time=102ms
INFO: Load project pull requests
INFO: Load project pull requests (done) | time=104ms
INFO: Load branch configuration
INFO: Detected analysis for pull request '3061' targeting 'develop'
INFO: Auto-configuring pull request 3061
INFO: Load branch configuration (done) | time=262ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=154ms
INFO: Load active rules
INFO: Load active rules (done) | time=3870ms
INFO: Organization key: kites-software
INFO: Pull request 3061 for merge into develop from PipelineConfigs/Add-sonarcloud
INFO: Load project repositories
INFO: Load project repositories (done) | time=113ms
INFO: SCM collecting changed files in the branch
INFO: Indexing files...
INFO: Project configuration:
INFO: 2134 files indexed
INFO: 1 file ignored because of scm ignore settings
INFO: Quality profile for css: Sonar way
INFO: Quality profile for js: Sonar way
INFO: Quality profile for json: Sonar way
INFO: Quality profile for ts: Sonar way
INFO: Quality profile for web: Sonar way
INFO: Quality profile for yaml: Sonar way
INFO: ------------- Run sensors on module Kites_Software_ebsfrontend
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=114ms
INFO: Sensor CSS Metrics [cssfamily]
INFO: Sensor CSS Metrics [cssfamily] (done) | time=568ms
INFO: Sensor CSS Rules [cssfamily]
INFO: 640 source files to be analyzed
INFO: 640/640 source files have been analyzed
INFO: Sensor CSS Rules [cssfamily] (done) | time=5254ms
INFO: Sensor IaC CloudFormation Sensor [iac]
INFO: 0 source files to be analyzed
INFO: 0/0 source files have been analyzed
INFO: Sensor IaC CloudFormation Sensor [iac] (done) | time=105ms
INFO: Sensor C# Project Type Information [csharp]
INFO: Sensor C# Project Type Information [csharp] (done) | time=2ms
INFO: Sensor C# Analysis Log [csharp]
INFO: Sensor C# Analysis Log [csharp] (done) | time=26ms
INFO: Sensor C# Properties [csharp]
INFO: Sensor C# Properties [csharp] (done) | time=0ms
INFO: Sensor JavaXmlSensor [java]
INFO: Sensor JavaXmlSensor [java] (done) | time=30ms
INFO: Sensor HTML [web]
INFO: Sensor HTML [web] (done) | time=932ms
INFO: Sensor VB.NET Project Type Information [vbnet]
INFO: Sensor VB.NET Project Type Information [vbnet] (done) | time=3ms
INFO: Sensor VB.NET Analysis Log [vbnet]
INFO: Sensor VB.NET Analysis Log [vbnet] (done) | time=16ms
INFO: Sensor VB.NET Properties [vbnet]
INFO: Sensor VB.NET Properties [vbnet] (done) | time=0ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=7ms
INFO: Sensor JavaScript analysis [javascript]
INFO: Deploying custom rules bundle jar:file:/root/.sonar/cache/8aa50956575faef23c5a269a418f196f/sonar-securityjsfrontend-plugin.jar!/js-vulnerabilities-rules-1.0.0.tgz to /opt/atlassian/pipelines/agent/build/.scannerwork/.sonartmp/eslint-bridge-bundle/package/custom-rules4635468121129128093
INFO: 3 source files to be analyzed
INFO: 3/3 source files have been analyzed
INFO: Sensor JavaScript analysis [javascript] (done) | time=5740ms
INFO: Sensor TypeScript analysis [javascript]
INFO: Found 1 tsconfig.json file(s): [/opt/atlassian/pipelines/agent/build/tsconfig.json]
INFO: 1376 source files to be analyzed
INFO: Analyzing 1376 files using tsconfig: /opt/atlassian/pipelines/agent/build/tsconfig.json
INFO: 0/1376 files analyzed, current file: src/app/features/accounting/accounting-shared/accounting-document-actions-names.ts
INFO: 0/1376 files analyzed, current file: src/app/features/accounting/accounting-shared/accounting-document-actions-names.ts
INFO: 0/1376 files analyzed, current file: src/app/features/accounting/accounting-shared/accounting-document-actions-names.ts
INFO: 0/1376 files analyzed, current file: src/app/features/accounting/accounting-shared/accounting-document-actions-names.ts
INFO: 0/1376 files analyzed, current file: src/app/features/accounting/accounting-shared/accounting-document-actions-names.ts
INFO: 0/1376 files analyzed, current file: src/app/features/accounting/accounting-shared/accounting-document-actions-names.ts
INFO: 0/1376 files analyzed, current file: src/app/features/accounting/accounting-shared/accounting-document-actions-names.ts
INFO: 0/1376 files analyzed, current file: src/app/features/accounting/accounting-shared/accounting-document-actions-names.ts
INFO: 0/1376 files analyzed, current file: src/app/features/accounting/accounting-shared/accounting-document-actions-names.ts
INFO: 0/1376 files analyzed, current file: src/app/features/accounting/accounting-shared/accounting-document-actions-names.ts
INFO: 0/1376 files analyzed, current file: src/app/features/accounting/accounting-shared/accounting-document-actions-names.ts
INFO: 0/1376 files analyzed, current file: src/app/features/accounting/accounting-shared/accounting-document-actions-names.ts
time="2021-10-27T11:43:39Z" level=error msg="error waiting for container: unexpected EOF"

  • Pipeline
image:
  name: osamayousry/node-chrome:node10-chrome-stable93

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: node:10
      memory: 7128
      caches:
        - sonar
      script:
        - pipe: sonarsource/sonarcloud-scan:1.2.2
  - step: &check-quality-gate-sonarcloud
      name: Check the Quality Gate on SonarCloud
      image: node:10
      script:
        - pipe: sonarsource/sonarcloud-quality-gate:0.1.4

pipelines:
  custom: # Pipelines that are triggered manually
    Develop Integration: # The name that is displayed in the list in the Bitbucket Cloud GUI
      - step:
          name: Install node modules
          image: node:10
          script:
            - export ebsFrontURL="https://$BUSER:$BPASS@bitbucket.org/Kites_Software/ebsfrontend.git"
            - git pull $ebsFrontURL develop
            - npm install
          caches:
            - node
      - parallel:
          - step:
              name: Run Accounting Tests
              script:
                - npm install
                - npm run test:accounting:ci
              caches:
                - node
          - step:
              name: Run Order Tests
              script:
                - npm install
                - npm run test:order:ci
              caches:
                - node
          - step:
              name: Run Inventory Tests
              script:
                - npm install
                - npm run test:inventory:ci
              caches:
                - node
          - step:
              name: Run MasterData Tests
              script:
                - npm install
                - npm run test:masterdata:ci
              caches:
                - node
          - step:
              name: Run Shared Tests
              script:
                - npm install
                - npm run test:shared:ci
              caches:
                - node
          - step:
              name: Build develop
              image: node:10
              script:
                - npm install
                - npm run build:aot
              caches:
                - node
  branches:
    develop:
      - step:
          name: Build develop
          image: node:10
          script:
            - npm install
            - npm run build:prod:aot
          artifacts:
            - dist/**
          caches:
            - node
      - step: *build-test-sonarcloud
      - step: *check-quality-gate-sonarcloud

    master:
      - step:
          name: Build
          image: node:10
          script:
            - npm install
            - npm run build:prod:aot
          artifacts:
            - dist/**
          caches:
            - node
      - step: *build-test-sonarcloud
      - step: *check-quality-gate-sonarcloud

  pull-requests:
    '**':
      - step:
          name: Build
          image: node:10
          script:
            - npm install
            # - npm run build:prod:aot
          artifacts:
            - dist/**
          caches:
            - node
      - step: *build-test-sonarcloud
      - step: *check-quality-gate-sonarcloud
options:
  size: 2x
  max-time: 30

Thanks and appreciate the help :slight_smile:

Hello,

Seems like your project is quite big right ? Were you ever able to run the analysis ?

I guess the straightforward answer is that you are running into the memory limits of your bitbucket-pipeline docker container during the analysis, so you should see if you can resize it and allocate more memory for the analysis to be able to run.

Hello Gregoire! thanks for your reply but I tried to increase the size for the step to 2x and docker memory up to 7128 and still same error… any other suggestions?

Hello,

Did you try running the analysis locally ? Does it work ? Does it go to the end ? Or are you running into the same error ?

the problem was that our docker container on bitbucket pipelines was consuming only 1g we upgraded to 4g and now working fine. Thanks!

Ok great! Thanks for letting us know!

What did you have to change to upgrade it to 4g ? If you can share your solution it could help someone else facing the same issue.