First I want to apologise for writing a new topic, as this question might be already answered (unfortunately I didn’t find it).
Well, I am curious if there is option to have PR decoration and Sonar check connected to Github with SonarCloud Automatic Analysis disabled.
As far I have found out is that code coverage is not available inside Automatic Analysis, so we’re willing to switch to use sonar-scanner inside our pipeline on GCP Cloud Build, but it requires SonarCloud Automatic Analysis to be disabled.
Once I have disabled it, we do not have PR decoration nor Sonar check inside our Github.
Is there option to configure so or some workaround?
ALM used: GitHub
CI system used: GCP Cloud Build
Scanner command used when applicable (private details masked)
It is possible.
You need to set the sonar.pullrequest.key parameter when running sonar-scanner in the CI pipeline of your PR (see the documentation).
For most CIs, this parameter is optional, as we can detect the value from environment variable. However we do not support GCP Cloud Build yet, so you need to set it manually.
@benoit - @markovistica & our other team members tried this approach, but we don’t see PR decoration (the same issue pointed by Nicholaus also). Can you please let us know if PR decoration is possible with GitHub and GCP Cloud Build?
Hi, I finally fix this problem.
The problem is GCP cloud build with Github app only do shallow clone of the repo. This make sonar scanner scm auto detection failed to detect as git repo. My assumption is because sonar scanner doesn’t know the scm then github webhook not triggered.