Is there an option for bulk importing projects when using Github integration

  • The version of SonarQube: 9.2.4.50792
  • Trying to mass import projects through Github when the integration with Github Enterprise is setup.

For the Github integration, the Github App gives an option to import projects to SonarQube server. In a production environment, is there a way to mass import projects to the server, or do the imports have to be done manually?

Hi,

Welcome to the community!

The import UI is built around the assumption that you’ll want to walk all the way through the wizard and get the analysis configuration help it gives. But it’s by no means required.

In fact, you can simply use the web api to iteratively api/projects/create each project. (Sorry, scripting a loop is as “bulk” as it gets.) Or, you can fall back to the old ways and allow SonarQube to automatically create each project on first analysis.

 
HTH,
Ann

Is there documentation on how SonarQube creates a project on first analysis? For example, there is no project yet created and the Github app is installed for Github integration. We want to test the branch before merging to master, how does analyzing the PR or branch create the projects?

Hi,

Not as such, no. Historically, this has just been the way it worked. Then we added the ability to provision a project server-side in case you needed to configure it before the first analysis and eventually that expanded into importing from the DevOps platform. But that import is basically a fancy provisioning.

Projects created on first analysis will be created with on the sonar.projectKey passed in during analysis. The permissions will be set from the applicable permission template. Default Quality Profiles will be used in the analysis.

If the first analysis is identified as a branch or PR, the project will be created with an empty main branch and the branch/PR under analysis populated as appropriate.

I’m not sure I understood the question^, so I’m not sure I’ve answered it. Does that help?

 
Ann

1 Like

Yea, they do answer my questions. Thank you!

1 Like