Hi all,
Is there any available documentation on the current best practice for automating SonarQube Cloud project creation? I’ve inherited some code that’s doing this for us today, but it has some problems.
Specifically, we are using GitLab as an ALM, which for some time now has created a default branch called main
. We’re invoking the api/projects/create
endpoint:
https://sonarcloud.io/web_api/api/projects?query=create&deprecated=false
This by default creates a branch called master
, which becomes the MAIN BRANCH in Sonar; when main
is published, this is then seen as a short-lived branch. I don’t see any way to specify the branch name in this call. It also lacks the ALM integration that would enable PR decoration etc.
In investigating alternatives, I was drawn to the ALM endpoints, although they seem to be a) SonarQube specific(?) and b) deprecated:
and this in turn took me to what appears to be the replacement, and may well be common across SonarQube and SonarCloud:
https://sonarcloud.io/web_api/new_api/dop-translation?deprecated=false
Is this a fruitful avenue of exploration? Is there any documentation around how to authenticate with and use these new APIs?
UPDATE: Found some documentation at SonarQube Web API, and one of my first problems seems to be a result of using Basic
auth, where the new APIs rely on a Bearer
token.