When running on a standard 8 core Ubuntu runner from Github itself, everything runs fine. We can also run on a now deprecated Philips-Labs self-hosted runner. Both of these CI environments will produce a report in our Sonar UI and post a comment on the PR with analysis information to Github.
Simply running on an AWS CodeBuild runner is enough to break the reporting process. None of the runs, reports, or even PR branches will show in the Sonar UI when run via CodeBuild. In the log output, ANALYSIS SUCCESSFUL link will have the org and repo name, but lack the pull request context that does show up on other runner flavors. Seemingly related issue and possible workaround: SonarCloud PullRequest analysis not working - #4 by Parasappa_Yaragal
We tried unsetting these environment variables, as well as allCODEBUILD_ variables in various iterations. Nothing seems to change the behavior.
Automatic detection of PR parameters in a GitHub Actions environment relies on the presence of a GITHUB_ACTIONS environment variable
The scanner does no automatic inference of PR parameters when AWS CodeBuild is detected (presence of CODEBUILD_BUILD_ID and CODEBUILD_START_TIME)
Frustratingly, as found in this post that you noted, if multiple CI environments are detected the autoconfiguration gives up
To be honest, I’m not familiar at all with AWS Code Build runners (until today I thought AWS Code Build and GitHub Actions were very distinct platforms). You learn something new everyday.
Providing the PR parameters appears to do the trick. By passing the following to the SonarQube Github Action we are successfully getting analysis results on CodeBuild runs: