Sonarsource/sonarcloud-quality-gate:0.1.1 pipe throws error: ✖ Quality Gate failed: Could not parse compute engine task from json

  • ALM used: Bitbucket Cloud
  • CI system used Bitbucket-pipelines
  • Scanner command used: bitbucket-pipelines plugin sonarsource/sonarcloud-scan:1.0.1
  • Languages of the repository: typescript, javascript, css
  • Error observed ✖ Quality Gate failed: Could not parse compute engine task from json This error happens about 50% of the time the pipeline is run.
  • Steps to reproduce: Ran the bitbucket-pipelines plugins sonarsource/sonarcloud-scan:1.0.1 step, then the sonarsource/sonarcloud-quality-gate:0.1.1 step.
  • Potential workaround: When we rerun the pipeline, the quality gate step doesn’t throw this error and the quality gate step passes. However, we are wasting build minutes rerunning the pipeline and want to know if this is a common issue, what the possible resolution is/if the sonar team is working on a fix for this.

Any insight?

Has anyone else seen this error?

Yes, same error here.

Because there is no obj[‘task’][‘analysisId’] when CE task is not completed.
You can sleep some seconds before check quality gate.

Waiting for sonarcloud team to fix this issue.

1 Like

Thanks for your feedbacks, we will investigate this issue and come back to you.
Cheers.

1 Like

Same issue with version 0.1.2

Any update on this? We’re also seeing this same error with the latest version (0.1.2).

✖ Quality Gate failed: Could not parse compute engine task from json: 
{
    "task": {
        "id": "XXXXX",
        "type": "REPORT",
        "componentId": "XXXXX",
        "componentKey": "<org>_<project name>",
        "componentName": "<project name>",
        "componentQualifier": "TRK",
        "status": "IN_PROGRESS",
        "submittedAt": "2019-09-16T13:00:35+0200",
        "submitterLogin": "<usernane>@bitbucket",
        "startedAt": "2019-09-16T13:00:35+0200",
        "executionTimeMs": 4686,
        "logs": false,
        "organization": "<org>",
        "warnings": []
    }
}

Thank you for reporting, this is clearly a bug. We’ll try to roll out a fix very soon.

You can track it here: https://jira.sonarsource.com/browse/SCCOMM-3

2 Likes

Version 0.1.3 with the fix is released, enjoy!

3 Likes

Source - Bitbucket Cloud
Scanner command used: bitbucket-pipelines.yml file

image: python:3.7.3
clone:
  depth: full

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
        caches:
          - sonar
        script:
          - pipe: sonarsource/sonarcloud-scan:1.0.1
            variables:
              SONAR_TOKEN: ${SONAR_TOKEN}
              EXTRA_ARGS: '-Dsonar.sources=. -Dsonar.test.exclusions="Requirements/**,config/**,data_migrations/**,requirements.txt,db_scripts/**,**/*.xml,fixture/**,static/**,templates/**" -Dsonar.exclusions="Requirements/**,config/**,data_migrations/**,requirements.txt,db_scripts/**,**/*.xml,fixture/**,static/**,templates/**"'
          - pipe: sonarsource/sonarcloud-quality-gate:0.1.3
            variables:
              SONAR_TOKEN: ${SONAR_TOKEN}
              EXTRA_ARGS: '-Dsonar.projectDescription=\"Backend API\" -Dsonar.eslint.reportPaths=\"report.json\" -Dsonar.qualitygate.wait=true -Dsonar.qualitygate.timeout=300'
              SONAR_SCANNER_OPTS: -Xmx512m
              DEBUG: "true"

pipelines:
  pull-requests:
    '**':
      - step: *build-test-sonarcloud

Error observed Quality Gate failed: Could not fetch compute engine task: b''
It fails each time but same .yml file work for other projects.

Hi @bharat_shekhawat,

We’ve done some improvements in recent months. Do you still have this issue?

Also, please verify that SONAR_TOKEN is defined in Repository settings / Repository variables (or even Workspace variables). When it’s not defined, it can cause the result you are getting. (We plan to improve the handling of such configuration errors to be user-friendly.)