SonarQube未能完成对此提交的审核:无法审核作者的提交

时间:2017-08-09 12:01:46

标签: sonarqube gitlab-ci

我根本找不到任何有关此内容的信息。唯一的搜索返回来自源代码本身。

https://www.google.com/search?site=&source=hp&q=%22unable+to+create+retrive+author%22&oq=%22unable+to+create+retrive+author%22&gs_l=psy-ab.3..33i22i29i30k1l4.4603.10463.0.10991.41.19.0.0.0.0.984.2208.0j2j1j5-1j1.5.0....0...1.1.64.psy-ab..36.3.1063...0.O7TJHAo3Irg

标题说明了问题所在。我从未见过这个错误,但现在它发生在我运行的每个管道上。我不知道为什么或何时开始。如果我想出来,我会发布解决方案。

我会检查SonarQube权限并尝试确保所有内容都配置正确。

17:07:07.624 INFO: ANALYSIS SUCCESSFUL
17:07:07.625 DEBUG: IssuesSeverityBreaker is disabled (sonar.buildbreaker.preview.issuesSeverity == DISABLED)
17:07:07.625 DEBUG: QualityGateBreaker is disabled (sonar.analysis.mode != publish)
17:07:07.627 DEBUG: Post-jobs : GitLab Commit Issue Publisher (wrapped)
17:07:07.627 INFO: Executing post-job GitLab Commit Issue Publisher (wrapped)
17:07:07.757 ERROR: SonarQube failed to complete the review of this commit
java.lang.IllegalStateException: Unable to create retrive author for commit 7ee2dab421610f30a8b
    at com.talanlabs.sonar.plugins.gitlab.CommitFacade.getUsernameForRevision(CommitFacade.java:228)
    at com.talanlabs.sonar.plugins.gitlab.CommitIssuePostJob.updateGlobalComments(CommitIssuePostJob.java:177)
    at com.talanlabs.sonar.plugins.gitlab.CommitIssuePostJob.execute(CommitIssuePostJob.java:72)
    at org.sonar.scanner.postjob.PostJobWrapper.executeOn(PostJobWrapper.java:58)
    at org.sonar.scanner.phases.PostJobsExecutor.execute(PostJobsExecutor.java:65)
    at org.sonar.scanner.phases.PostJobsExecutor.execute(PostJobsExecutor.java:54)
    at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:81)
    at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:178)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:144)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:129)
    at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:259)
    at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:254)
    at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:243)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:144)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:129)
    at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:47)
    at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:86)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:144)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:129)
    at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:118)
    at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:117)
    at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:63)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
    at com.sun.proxy.$Proxy0.execute(Unknown Source)
    at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:233)
    at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151)
    at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:123)
    at org.sonarsource.scanner.cli.Main.execute(Main.java:77)
    at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: com.talanlabs.gitlab.api.GitLabAPIException: {"message":"403 Forbidden  - Not authorized to access /api/v4/users"}
    at com.talanlabs.gitlab.api.http.GitLabHTTPRequestor.handleAPIError(GitLabHTTPRequestor.java:378)
    at com.talanlabs.gitlab.api.http.GitLabHTTPRequestor.toPaged(GitLabHTTPRequestor.java:149)
    at com.talanlabs.gitlab.api.services.GitLabAPIUsers.getUsers(GitLabAPIUsers.java:59)
    at com.talanlabs.sonar.plugins.gitlab.CommitFacade.getUsernameForRevision(CommitFacade.java:214)
    ... 32 common frames omitted
Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: https://gitlab.company.com/api/v3/users?search=first.m.last%40company.com
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1876)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
    at com.talanlabs.gitlab.api.http.GitLabHTTPRequestor.parse(GitLabHTTPRequestor.java:336)
    at com.talanlabs.gitlab.api.http.GitLabHTTPRequestor.toPaged(GitLabHTTPRequestor.java:144)
    ... 34 common frames omitted

17:07:07.839 INFO: Task total time: 12.279 s
17:07:07.839 INFO: ------------------------------------------------------------------------
17:07:07.839 INFO: EXECUTION SUCCESS
17:07:07.839 INFO: ------------------------------------------------------------------------
17:07:07.839 INFO: Total time: 15.686s
17:07:07.951 INFO: Final Memory: 49M/449M
17:07:07.951 INFO: ------------------------------------------------------------------------
17:07:07.951 DEBUG: Execution getVersion
17:07:07.951 DEBUG: Execution stop
Process returned exit code 0
The SonarQube Scanner has finished
17:07:08.303  Creating a summary markdown file...
17:07:08.303  Analysis results: http://server:9000/dashboard/index/ft-hzn-sps-db
17:07:08.304  Post-processing succeeded.
Creating cache default...
Created cache
Job succeeded

1 个答案:

答案 0 :(得分:2)

以下是日志告诉我们您的问题:

java.lang.IllegalStateException: Unable to create retrive author for commit 7ee2dab421610f30a8b

SonarQube尝试获取git commit 7ee2dab421610f30a8b的作者,因为它使用 blame 信息自动分配问题并在UI中显示此类信息。但是,由于这些原因,检索作者不起作用:

com.talanlabs.gitlab.api.GitLabAPIException: {"message":"403 Forbidden  - Not authorized to access /api/v4/users"}

用于在git中访问此信息的框架尝试访问api,但获得了授权异常(http代码403)。

Server returned HTTP response code: 403 for URL: https://gitlab.company.com/api/v3/users?search=first.m.last%40company.com

当尝试使用电子邮件地址first.m.last@company.com(这似乎是一个虚假的电子邮件地址)搜索用户时出现问题。

因此,要解决此问题,您应该为运行SonarQube分析的用户提供足够的权限,并且您应该检查您的git历史记录不包含异常数据。