Scanner command used when applicable (gradle sonar -Dsonar.token=$SONAR_TOKEN -Dsonar.organization=$SONAR_ORGANIZATION -Dsonar.projectKey=$SONAR_PROJECT_KEY)
Languages of the repository: Gradle Kotlin Java 17
Error observed (Quality gates fail in SonarCloud and a comment is added to Gitlab MR with results, but the MR is still allowed to be merged)
We want to block the MR merge if the SonarCloud Quality gates fail.
Based on the docs, I’m wondering if you’ve set allow_failure: true:
It is also possible to allow a job to fail without impacting the rest of the CI suite with the allow_failure: true parameter of GitLab CI. The failing job won’t stop the pipeline but will be displayed as in a warning state.
It seems like unsetting that should get the result you’re after.
My point was not to add this, if that’s what you did. But that setting this option would allow merge of an MR that fails the Quality Gate. You should make sure this is not set.
And then I suppose the missing piece is this (again from the docs):
To enable this feature, you can set the sonar.qualitygate.wait=true parameter