GitHub commit decoration works with one organization but not others

  • ALM used: GitHub
  • CI system used: GitHub Actions
  • Scanner command used:
    sonar-scanner -Dsonar.projectKey=magicphotos_magicphotos-android \
                            -Dsonar.projectName="MagicPhotos Android" \
                            -Dsonar.organization=magicphotos-github \
                            -Dsonar.sources=. \
                            -Dsonar.sourceEncoding=UTF-8 \
                            -Dsonar.exclusions="qml/**/*,translations/*" \
                            -Dsonar.cfamily.build-wrapper-output=.build/bw-output \
                            -Dsonar.cfamily.cache.enabled=false \
                            -Dsonar.cfamily.threads=1 \
                            -Dsonar.java.source=1.7 \
                            -Dsonar.java.binaries=.build \
                            -Dsonar.host.url=https://sonarcloud.io
  • Languages of the repository: C++, Java
  • Error observed:

I have a few GitHub organizations linked to my account, and I run SonarCloud analysis for some repos owned by these organizations. Relatively recently (in January) I added a new organization to my SonarCloud account and then I noticed that, unlike other organizations, for this new organization commit decoration is performed by SonarCloud. This is an example of such commit decoration for repo from new organization:

However, for organizations added earlier commit decoration is not performed:

I wonder, why is this? SonarCloud-related scripts are almost the same for both repos (except things like sonar.projectKey, sonar.projectName and sonar.organization). I tried to reinstall SonarCloud GitHub app for earlier added organization, but no luck. I would like to avoid deleting and re-adding the GitHub organization to SonarCloud unless it is absolutely necessary. What else I can do to enable commit decoration for all my organizations?

Hi @oleg-derevenetz

I see the MagicPhotos organization is bound to GitHub, but the MagicPhotosAndroid project is not (no small Github icon at the right of the name of the project on the SonarCloud UI).

Sakura Android project on SonarCloud
MagicPhotos Android project on SonarCloud

The MagicPhotos Android project has probably been added manually on SonarCloud, while the Sakura-android was imported from the GitHub organization.
That’s likely why the GitHub Check decoration works for the Sakura-Android project and not for the MagicPhotosAndroid project.

The better solution, to benefit from all the features, would be to import the project from GitHub, using the “+” menu (top right corner, next to your avatar) > Analyze new project > MagicPhotos organization.
The new project won’t get the history though.

If you don’t want to restart from scratch, but with only a subset of the features (for example no list of contributors on the pull request list), you can add the following parameters to the scanner execution of the MagicPhotosAndroid project:

-Dsonar.pullrequest.provider=github
-Dsonar.pullrequest.github.repository=magicphotos/magicphotos-android

My advice is to always import projects from the GitHub organization to SonarCloud in the future, as you probably did for the Sakura Android project.

HTH,
Claire

2 Likes

Removing projects from SonarCloud and re-importing from GitHub helped, thank you!

1 Like

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