Timeout parameter not able to use in pipeline: sonarcloud-quality-gate

I just got below error when running pipeline with the sonarcloud-quality-gate configuration

  • Error observed (
βœ– Unknown error: unsupported operand type(s) for //: 'str' and 'int' 

)

  • Steps to reproduce (
    Pipeline configuration as:
          - pipe: sonarsource/sonarcloud-scan:1.1.0
          - pipe: sonarsource/sonarcloud-quality-gate:0.1.3
            variables:
              SONAR_QUALITY_GATE_TIMEOUT: 60

)

  • Potential workaround: remove the variables

Hi @xiao,

Could you specify what is your working environment, especially what ALM you are using?

Thanks,
@AlxO

Hi Alex,

We are using bitbucket pipeline for manage our python code.
The detail configuration of this part in pipeline yaml file is like:

Summary
definitions:
  services:
    docker:
      memory: 2048
  steps:
    - step: &code-style
        name: "Code Style"
        script:
          - pycodestyle --config .pycodestyle **/**.py
    - step: &sonar-scan
        image: atlassian/default-image:2
        name: "Sonar Scan and Quality Gate"
        size: 2x
        caches:
          - docker
        script:
          - pipe: sonarsource/sonarcloud-scan:1.1.0
          - pipe: sonarsource/sonarcloud-quality-gate:0.1.3
            variables:
               SONAR_QUALITY_GATE_TIMEOUT: 60

Hi @xiao,

This documentation suggest putting the variable between simple quotes, e.g.:

SONAR_QUALITY_GATE_TIMEOUT: '<int>'  # Optional

variables:
SONAR_QUALITY_GATE_TIMEOUT: β€˜60’

I don’t know if this correct, but did you try that?

1 Like

Hi Alex,

I tried both, with and without simple quotes, both got the same error:

βœ– Unknown error: unsupported operand type(s) for //: 'str' and 'int'

Thank you for reporting this.

I confirm there is a problem, it’s impossible to use the SONAR_QUALITY_GATE_TIMEOUT variable at the moment. You have no choice but to omit it, and let the pipe use the default timeout (5 minutes).

I created ticket to track this bug: https://jira.sonarsource.com/browse/SCCOMM-44