Details
Description
For GitLab, we'll implement a mechanism to wait and fail the SonarQube check when the Quality Gate is red.
We'll implement this mechanism in the Scanner, thanks to additional options for scanner:
- sonar.qualitygate.wait=false - enable/disable a scanner wait for QG result (value set to `false` if not specified)
- sonar.qualitygate.timeout=300 (s) - set a time in seconds for how long scanner should wait for report to be processed (property is taken into account only if sonar.qualitygate.wait is set to `true`)
For this, we'll add a step to scanner engine step just after report is published, so that the step can use values from properties to actively poll CE task endpoint (api/ce/task) for status within given time.
- If task has success status, get Quality Gate status using api/qualitygates/project_status endpoint, otherwise (failed, canceled) stop processing with appropriate reason.
- In case status pending/ in_progress continue polling until timeout is reached.