SonarCloud + GitLab = ❤️

Does Sonarcloud have an API endpoint that would allow us to automate importing a project into Sonarcloud from Gitlab?

Or is the only option for Sonarcloud users is to manually select the projects they want to import using the “Analyze projects” UI?

1 Like

Hi Tim,
there is API at the moment to create a “bound” project directly connected to GitLab.
I’d advise you to add your feedback to the corresponding Portal Card to explain your use case and vote for this feature :slight_smile:

Thanks,
Christophe

1 Like

Hello Community,

I am trying to setup the sonar integration within gitlab-ci.yml. My goal is to run the sonar analysis and test coverage only on merge requests however, when I run the task it fails due to the fact that it can’t find the MR id:

Caused by: Could not find the pullrequest with key '110'
Caused by: org.sonarqube.ws.client.HttpException: Error 404 on https://sonarcloud.io/api/alm_integration/show_pullrequest?project=parkhere_invoice-event-processor&pullrequestKey=110 : {"errors":[{"msg":"Unable to find the pullrequest with key \u0027110\u0027"}]}

Our project has a main gradle with multiple modules, one for each lambda functions and of course each module has it’s own build.gradle file. When we try to import our gitlab repo to sonar through the dashboard UI, it identifies each gradle module as a separate project and import them separately whereas all the modules are part of single Gitlab repo. It’s all fine except for the fact that the ci/cd integration doesn’t work for merge requests as I mentioned.

My question is how can I establish this integration without the need to change our project setup and still get the code analysis and test coverage for each module whenever there is a new merge requests for that project.

I will appreciate your inputs.
Esfandiyar

You’ve mentioned that there is an API, but is this API available to existing users? I’m a little bit confused.

Thanks for linking me to the Portal Card. I was able to give feedback and vote for that feature.