Extra properties key for setting quality gate for the project

Hi, is there any extra properties key or something else for setting quality gate of the project from build pipeline?

  • ALM used (Azure DevOps)
  • CI system used Azure DevOps
  • Scanner command used when applicable (private details masked):
  - task: SonarCloudPrepare@1
    inputs:
      SonarCloud: '#####SonarConnection'
      organization: '#######'
      scannerMode: 'CLI'
      configMode: 'manual'
      cliProjectKey: $(Build.Repository.Name)
      cliProjectName: $(Build.Repository.Name)
      cliSources: '.'
      extraProperties: |
            sonar.inclusions=**/#####/**
            sonar.exclusions=**/#######/**
            sonar.javascript.lcov.reportPaths=$(Build.SourcesDirectory)/coverage/lcov.info

            sonar.qualitygate=?????? (or something like this?)

Hi,

set the quality gate via web api POST api/qualitygates/select, see
yoursonarinstance/web_api/api/qualitygates

Gilbert

2 Likes

Thanks, that worked for me;

  - task: Bash@3
    displayName: 'Setting SonarCloud Project Quality Gate'
    inputs:
      targetType: 'inline'
      script: 'curl -v -X POST https://${YOUR_SONARCLOUD_TOKEN}@sonarcloud.io/api/qualitygates/select -d "gateId=${YOUR_SONARCLOUD_GATEID}&projectKey=${YOUR_SONARCLOUD_PROJ_KEY}&organization=${YOUR_SONARCLOUD_ORG}"'