SonarQube 8.0 - gitlab.com authentication integration

Hi all,

After the announcement for GitLab user authentication integration we were excited to try it out.

However, having followed the instructions from https://docs.sonarqube.org/latest/instance-administration/delegated-auth/ and configuring an OAuth Application within gitlab.com, upon attempted login via gitlab all I see is the following under gitlab.com:

An error has occurred

The redirect URI included is not valid.

The serverBaseURL is configured on sonarqube, and I’ve tried different combinations of http/https URLs, neither of which seems to be working.

We’ve been told that the gitlab integration works also with gitlab.com, but I’am a bit skeptical how that might be so, seeing how I can register an OAuth application only under my User profile. And we would want to have all the members of a Group using the gitlab.com login.

So there are two concrete questions:

  1. Can we use gitlab integration with gitlab.com Group structures?
  2. If yes, any idea what I might be doing wrong?

Cheers,
Gergo

Gergo,

I can at least confidently answer your question about this error:

An error has occurred

The redirect URI included is not valid.

There is a bug in our documentation – you should omit the trailing slash from https://YourSonarQubeURL.com/oauth2/callback/gitlab/ (so, https://YourSonarQubeURL.com/oauth2/callback/gitlab). This documentation error will be fixed with the next version of SonarQube!

As for this…

It appears you will need to create an OAuth application under a specific user account, absent a higher level concept you could create it under (like I would imagine there is for other flavours of GitLab).

I had no issues using an OAuth application created by my account to login users who aren’t the creator of that application. Group sync works fine as well.

We’re still in the early days of our products getting chummy with GitLab, so thanks for bearing with us! Feedback is more than welcome.

1 Like

Hi Colin,

Thank you for the swift response. Indeed the trailing slash was the one causing ruckus.
I was able to login with my user, but it just mapped me to the default ‘sonar-users’ group. Which let’s say is fine for now.

We’re very curious about the "Find issues in GitLab branches & merge requests " We’ve received a trial key for the Developers Edition and have registered our sonarqube instance with it, but under the General Settings -> SCM I still only see the 3 default github/bitbucket/azure devops options.

Do you have any documentation on how we can enable and use this feature?

Cheers,
Gergo

Gergo,

Pull (Merge) Request Decoration for GitLab is not yet a feature of SonarQube (keep an eye on MMF-1840), but if you’re using GitLab CI/CD there are some nifty autoconfiguration of analysis (see: Running Analysis with Gitlab CI/CD).

While you may not see anything in GitLab, you can still SonarQube results in SonarQube in the context of a specific branch/MR etc.

Colin

Hi Colin,

So I tried out the .gitlab-ci.yml snippet and it worked as expected, thank you for the link provided.

Truth be told, the expectations we had for this announcement was more in line with what the gitlab plugin does.

I guess we’ll be eagerly waiting for MMF-1840 to be implemented. That would be a minor release, right? Any estimates when it might be available?

Cheers,
Gergo

1 Like