Add PR summary to Github when building on BuildKite

Hello,

Our current setup is that we have our source code stored on Github but use BuildKite for CI. I have setup BuildKite to successfully scan the code using the docker image:

- name: ":sonarcloud: SC Scan"
    plugins:
      - docker#v5.7.0:
          image: "sonarsource/sonar-scanner-cli:4"
          environment:
            - "SONAR_TOKEN=XXXX"
            - "SONAR_HOST_URL=https://sonarcloud.io"
            - "SONAR_SCANNER_OPTS=-Dsonar.branch.name=$BUILDKITE_BRANCH -Dsonar.branch.target=$BUILDKITE_PULL_REQUEST_BASE_BRANCH"

In SonarCloud, my org is bound to Github and in the SC project, Pull Request summary is enabled.

I would expect to see Pull Request decoration in Github but I am not. Is it possible to get PR decoration when building in a separate CI? is there an additional setting i need to set?

Hi,

Is your project in SonarCloud “bound” to your project in GitHub? In order for SonarCloud to reach back to GitHub to update it with analysis results, it needs to know where to “reach”. And it needs to have permissions in GitHub to be able to do that.

So this isn’t about your CI. It’s mainly about initial project setup in SonarCloud.

 
Ann

Hello,

Yes the project is bound to github:

other projects in my org which do use github actions or automatic analysis are able to write the PR decoration

this is my sonar-project.properties file:

# Required Properties
sonar.projectKey = AvantFinCo_avant-templates
sonar.organization = avantfinco

# Optional Properties

sonar.projectName = avant-templates
# See here for details how to setup file patterns: https://docs.sonarcloud.io/advanced-setup/analysis-scope/
sonar.sources = .
# exclude test files, auto-generated files here
sonar.exclusions = **/spec/**/*
sonar.tests = spec/
sonar.projectVersion = Initial

sonar.ruby.coverage.reportPaths = coverage/coverage.json
sonar.coverage.exclusions = config/, db/, spec/

Hi,

And when you look at the project, do you see any warnings on its homepage?

 
Ann

just this:

image

Hi,

Thanks for the screenshot. One last question before I call in the big guns: when you look at the analysis in SonarCloud, it is presented as a PR analysis or as a branch analysis?

I.e. are you explicitly passing in the PR analysis parameter/value pairs?

 
Ann

i believe its showing up as a branch analysis. what are the PR analysis parameter/value pairs?

Hi,

Here you go:

 
HTH,
Ann