Automatically bind new projects to Github

In our pipeline we automatically create projects in SonarQube by running the sonar scanner in our pipeline. We would like to setup pull request decoration. The documentation here suggests that we need to bind every project manually to Github.

Is there a way to automatically bind projects that are created automatically from a solar scanner run?

Hey there.

What pipeline do you use? If it’s GitHub Actions, and you’re using SonarQube v10.3+, that binding should happen automatically..

With other CIs, however, you’ll have to rely on the UI or investigate using Web APIs to automate the binding (this is a helpful guide).

It is a Github Actions pipeline but we do not use a sonar action. We rely on the gradle plugin to perform the scanning. We will try it and see if projects are automatically bound. Thanks for the suggestion.

The first observation is the following: If a project does not exist in sonarqube yet the scan in the initial branch fails with the error:

No branch exists in Sonarqube with the name master

That looks to be coming from a plugin that enables branch analysis on the community edition of SonarQube. We won’t be able to help you there. :man_shrugging:

1 Like