When using Github Actions and Sonarcloud, the step in our CI running the code analysis always succeeds no matter the outcome of the quality gate (passed/failed). There are other jobs depending on this information.
In the meantime, is there another way of getting this crucial information in our CI? Lets say getting the latest analysis report for PR 123?
We are decorating your commits with a SonarCloud GitHub Check called “SonarCloud Code Analysis” that reflects the quality gate status (so it fails when the quality fails and passes otherwise).
yes, we do see this check. However, I’m not sure if it is possible to reference it from within the workflow. Let’s say we have 3 jobs that are all dependent on the success of the previous one:
tests > sonar cloud > deployment
From what I see the check “SonarCloud Code Analysis” lives outside the workflow, right?
Yes, that is correct, the check lives outside of that. You can set the sonar.qualitygate.wait=true parameter in your sonar-project.properties configuration file to make the job wait for the result and pass/fail based on the quality gate.
Could you provide more details about the following jobs so that we can better understand your use case?
thanks for your response, this was exactly what we were looking for, it works as expected! One last question: In the logs for the job is says “Waiting for the analysis report to be processed (max 300s)”. It was fast, as the project is still small but do you know if we will eventually hit that limit?