GitHub PR decoration with AWS CodeBuild

  • ALM used Github Enterprise
  • CI system used AWS CodeBuild
  • Scanner command used when applicable (private details masked)
  • Languages of the repository: Java

Hi,

I would like to configure our project to report the analysis status to GitHub PRs on our PullRequest Analysis.

We run our unit tests in an AWS CodeBuild container and use the Maven sonar-scanner to report the static analysis and code coverage to Sonarcloud.We can see PullRequest Analysis worked in our sonarcloud page, But in GitHub PullRequest, we can not see decoration from sonarcloud.

Does anybody know how to decorate GitHub PR?

Here’s how we invoke sonar-scanner

mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \
 -Dsonar.pullrequest.github.repository=$REPO \
 -Dsonar.sourceEncoding=UTF-8 \
 -Dsonar.projectKey=$KEY \
 -Dsonar.pullrequest.base=$BASE \
 -Dsonar.pullrequest.key=$PR_KEY \
 -Dsonar.pullrequest.branch=$BRANCH \
 -Dsonar.pull.request.provider=GitHub\

Here’s our current sonar-project.properties:

        <sonar.organization>$ORGANIZATION</sonar.organization>
        <sonar.host.url>https://sonarcloud.io</sonar.host.url>
        <sonar.coverage.jacoco.xmlReportPaths>**/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>

We also set environment variables GITHUB_TOKEN and SONAR_TOKEN.

Our organization bound to GitHub

Here’s our PullRequest Analysis in sonarcloud

We set Enable summary comment on

Thanks

Hey there.

To start, if your project is bound, (which it appears to be), you should remove sonar.pullrequest.github.repository and sonar.pull.request.provider.

It also looks like your last analysis had some warnings: (the upper right of your PR dashboard). What are they?

Hi
Thank you for reply

I removed sonar.pullrequest.github.repository and sonar.pull.request.provider but sonarcloud still don’t repot to GitHub PullRequest.

My PR dashboard warning is here.

I set CodeBuild to do git clone unshallow and I removed this warning, but sonarcloud still don’t report to PR…

Is your project bound (you’ve already shown that your organization is)

1 Like

I create new project that bound my organization, and sonarcloud reported to PR in this new project.
Thank you for your help, I really appreciate it!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.