Add quality profile by a script

Hello everyone,

I am writing an automated shell script that would allow me to get a docker container that contains Sonarqube community with custom plugins and quality profiles.
The plugin part is managed but I can’t understand how I can, via the shell script, add directly a quality profile because those are stored in base. How to add a profile in the database ? And how can I reach the database of my docker image?

Thanks for your help,

Elio M.

Hi Elio,

Ideally, you’re only going to need to create your Quality Profiles once because they are stored in the DB. You would then just make sure you always point to the same DB and you’re good. But if this doesn’t work for you, take a look at the web apis (docs link in the page footer).

The best way to master the API is to perform the desired action via the UI and eavesdrop to see which calls the UI made to accomplish the action.

You may also find this guide helpful.

You should treat SonarQube’s DB as a black box & therefore not have a need to reach it directly.

 
HTH,
Ann

Thank you Ann for your response,

However, even though I can create a database, I don’t understand in which format the quality profile should be saved and I can’t find any information on this in the documentation.

I would prefer to try this solution before switching to web APIs.

Have a nice day,
Elio

Hi Elio,

Quality Profiles should be created and saved via the UI. There’s no documentation on doing it manually because your not supposed to do that.

 
HTH,
Ann