I have good news, as well as some less good news.
- The good news: There’s an active sprint addressing this problem. While GitLab isn’t included in the current sprint’s scope, it will be covered in the upcoming one.
- The less good news: At the moment, there isn’t an amazingly great workaround. Project import doesn’t work and binding after project creation in the UI also requires the repositories to be listed.
However, what you can do is manually create the project, then use the Web API to bind it. This involves sending a POST request to https://api.sonarcloud.io/dop-translation/project-bindings with a payload like the following:
{
"projectId": "AZX8FyZAhfe4TD4HrpAU",
"repositoryId": "54355206"
}
- The
projectIdis found in theidfield fromhttps://sonarcloud.io/api/navigation/component?component=PROJECT_KEY. - The
repositoryIdis your project’s GitLab repository ID (visible in your GitLab project page).
The curl request would look like this:
curl -X POST "https://api.sonarcloud.io/dop-translation/project-bindings" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_SONARCLOUD_TOKEN" \
-d '{
"projectId": "PROJECT_ID",
"repositoryId": "REPO_ID"
}'
