From what I have seen I have to configure all of my SonarQube settings from the GUI and it gets stored in a DB?
Is there any feature where I could define my SonarQube config as code and deploy it to my SonarQube server? I want to automate the creation of new projects in SonarQube so it's not a manual process every time we add a new app.
Edit
Another way of accomplishing this would be if the Sonarscanner or the Jenkins plugin could create the sonar project for the app if it doesn't exist when it runs. And then I could have all the settings for the apps sonar project described in a config that lives in the app repo. Is this possible? Any best practices around this?
Edit
I am disappointed Sonar still doesn't support this, but this is how I did this in Jenkins:
httpRequest consoleLogResponseBody: true,
httpMode: 'POST',
contentType: 'APPLICATION_FORM',
validResponseCodes: '100:400', // catch 400 which is returned if project exists already
customHeaders: [[
maskValue: true,
name: 'Authorization',
value: "Basic ${javax.xml.bind.DatatypeConverter.printBase64Binary((sonar_cloud_token + ':').getBytes())}"
]],
url: "https://sonarcloud.io/api/projects/create",
requestBody: "name=${repo_name}&project=${workspace}_${repo_name}&organization=${workspace}
Specifically for Bitbucket and sonar cloud, there is still a really obnoxious manual step where you must link the repo to Sonar cloud from the BitBucket UI. Users have found a totally undocumented, not officially supported, API endpoint for doing this too though: