sonarqube集成gitlab身份验证

官方操作手册

预置条件

增加gitlab身份验证,需要qa@pconline.com.cn是管理员权限

gitlab增加application

https://git.pc.com.cn/oauth/applications/

个人设置-应用-创建 新应用

名称:SonarQube

Redirect URI:https://sonar.pc.com.cn/oauth2/callback/gitlab

勾选api及read_user

记录应用程序ID、密码等信息,sonar中设置要填写。

sonar设置

Sonarqube7.9以上版本,已经集成了gitlab和github,不用再单独使用sonar-gitlab-plugin-4.1.0-SNAPSHOT .jar插件,一定要在应用目录

/data/PRG/sonarqube-8.4.1.35646/extensions/plugins 中删除,否则会有影响。

管理员帐号登陆http://sonar.pc.com.cn/ admin/admin

配置:ALM集成-gitlab填写

重启应用

第一次用gitlab登陆的时候,会弹出权限框,点击【授权】即可

https://git.pc.com.cn/oauth/authorize?response_type=code&client_id=930d3778ff682e5b10010aa0f611fe1b4f32e53181696e40af811ea94313378e&redirect_uri=https%3A%2F%2Fsonar.pc.com.cn%2Foauth2%2Fcallback%2Fgitlab&scope=api&state=3ab4p688711gl48qcpeukt3diq

问题

1、登陆后跳转链接不对,请一定要把URL复制下来,分析一下redirect_uri是不是访问的http。是要用https访问的。所以sonar.peroperties配置中要sonar.core.serverBaseURL=https://sonar.pc.com.cn

2、如果还不行,建议去服务器重启sonarqube

3、Gitlab普通帐号创建应用是没办法有访问权限的,也会报错,要用gitlab管理员去创建应用

原文地址:https://www.cnblogs.com/sincoolvip/p/13953786.html