SonarCloud and Bitbucket Pipeline - how to stop the pipeline if scan fails?

Template for a good new topic, formatted with Markdown:

  • ALM used (GitHub, Bitbucket Cloud, Azure DevOps) - Bitbucket Cloud is used
  • CI system used (Bitbucket Cloud, Azure DevOps, Travis CI, Circle CI) - Bitbucket Pipelines is used
  • Scanner command used when applicable (private details masked) -
  • Languages of the repository - PHP is used
  • Only if the SonarCloud project is public, the URL
    • And if you need help with pull request decoration, then the URL to the PR too
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
  • Steps to reproduce
  • Potential workaround

I am using the following in bitbucket-pipelines.yml:

  • pipe: sonarsource/sonarcloud-scan:1.1.0
    variables:
    SONAR_TOKEN: $SONAR_TOKEN

Is there a variable that would stop the pipeline if the scan fails?

Welcome to the Community!

You can add a step using the sonarcloud-quality-gate pipe, it seems that will do what you need. Let us know if you need further help!

Hi Janos,

I was looking for this but we are using CircleCI, I could not find it in the docs or on the Github repo which hosts the orb: https://github.com/SonarSource/sonarcloud-circleci-orb.

Do you know if it exist, or if there is a plan to develop it?