简体   繁体   English

设置Sonar-Gerrit插件:无法在UserAtHost上执行命令“ gerrit review”

[英]Setting up Sonar-Gerrit plugin : Failed to execute command 'gerrit review ' on UserAtHost

I'm trying to set up the Sonar-Gerrit plugin on a Jenkin job. 我正在尝试在Jenkin作业上设置Sonar-Gerrit插件

Set up 设定

  1. Jenkins Maven job is launched when a patch set to Gerrit 当补丁设置为Gerrit时,将启动Jenkins Maven作业
  2. I see the error in the Jenkins output. 我在Jenkins输出中看到错误。

Here is the Jenkins console error output : 这是Jenkins控制台错误输出:

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905:sonar ( default-cli) on project parent: Failed to execute project builder: fr.techad.sonar.GerritProjectBuilder: Failed to execute command 'gerrit review 298816ea2b24645fd971a8c0833582cec1163dac -j' on UserAtHost@55a9f72f [user=jenkins, host=172.21.33.193, port=29418]: reject HostKey: 172.21.33.193 -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [错误]无法在项目父级上执行目标org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905:sonar(default-cli):无法执行项目生成器:fr.techad.sonar.GerritProjectBuilder:失败在UserAtHost @ 55a9f72f上执行命令'gerrit review 298816ea2b24645fd971a8c0833582cec1163dac -j'[user = jenkins,host = 172.21.33.193,port = 29418]:拒绝HostKey:172.21.33.193-> [Help 1] [ERROR] [ERROR]以查看有关错误的完整堆栈跟踪,请使用-e开关重新运行Maven。 [ERROR] Re-run Maven using the -X switch to enable full debug logging. [错误]使用-X开关重新运行Maven以启用完整的调试日志记录。 [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException [错误] [错误]有关错误和可能的解决方案的更多信息,请阅读以下文章:[错误] [帮助1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

What I have tried so far 到目前为止我尝试过的

Looking the [Help 1].It says 看[帮助1]。它说

this exception is not generated by the Maven core itself but by a plugin. 此异常不是由Maven核心本身生成的,而是由插件生成的。

  1. I tried to log in the Jenkins server and run "mvn sonar:sonar" in the directory(/usr/share/tomcat/.jenkins/workspace/sonar-maven).It runned successfully and I could see the results on the Sonar Dashboard. 我尝试登录Jenkins服务器并在目录(/usr/share/tomcat/.jenkins/workspace/sonar-maven)中运行“ mvn sonar:sonar”。它成功运行,并且可以在Sonar仪表板上看到结果。
  2. Reconfigure Gerrit Trigger plugin. 重新配置Gerrit触发器插件。 Then I checked the connection in the Gerrit Trigger,and it sad successful. 然后我在Gerrit触发器中检查了连接,并成功地成功了。

Did anyone have this same error? 有人有同样的错误吗? how can I try to fix it? 我该如何解决?

Software Version 软件版本

  • Jenkins 2.101 , Sonar-Gerrit plugin (2.3) ,Gerrit Trigger (2.21.2) Jenkins 2.101,Sonar-Gerrit插件(2.3),Gerrit触发器(2.21.2)
  • Gerrit 2.14.6 杰里特2.14.6
  • Sonarqube 6.7 Sonarqube 6.7

The error is: 错误是:

Failed to execute command 'gerrit review 298816ea2b24645fd971a8c0833582cec1163dac -j'

Sonar-gerrit uses the gerrit-trigger plugin to vote in Gerrit. Sonar-gerrit使用gerrit-trigger插件在Gerrit中投票。 It seems there is something wrong with the gerrit-trigger configuration. gerrit-trigger配置似乎出问题了。 I know you've checked the connection between gerrit-trigger and Gerrit but this is error is related to the "gerrit review" command. 我知道您已经检查了gerrit-trigger和Gerrit之间的连接,但这是与“ gerrit review”命令有关的错误。

Check the "gerrit review" command at: 在以下位置检查“ gerrit审查”命令:

Jenkins > Manage Jenkins > Gerrit Trigger > Edit > Advanced... > Gerrit Verified Commands Jenkins>管理Jenkins> Gerrit触发器>编辑>高级...> Gerrit验证命令

For example, it works to me with: 例如,它适用于我:

gerrit review <CHANGE>,<PATCHSET> --message 'Job finished <BUILDS_STATS>' --code-review <CODE_REVIEW>

After that, if the error persists, log in the Jenkins server and run the "gerrit review" command manually executing: 之后,如果错误仍然存​​在,请登录Jenkins服务器并手动执行“ gerrit review”命令:

ssh -p 29418 jenkins@172.21.33.193 gerrit review ssh -p 29418 jenkins@172.21.33.193 Gerrit评论

If you get the same error you can try to debug it adding "-vvv" to the command. 如果遇到相同的错误,则可以尝试对其进行调试,然后在命令中添加“ -vvv”。

your exception says: 您的例外说明:

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin

It's your maven plugin for sonar is failing the job, not the sonar-gerrit plugin. 这是您的声纳失败的Maven插件,而不是声纳Gerrit插件。

Failed to execute command 'gerrit review 298816ea2b24645fd971a8c0833582cec1163dac -j'

I don't know what does sonarqube command "gerrit review -j" and it looks like that this sonar-maven-plugin doesn't know it, either. 我不知道sonarqube命令“ gerrit review -j”是什么,看来这个sonar-maven-plugin也不知道。

You could try looking into this question - it may help you to configure sonarqube for your project: Why Maven command MVN sonar:sonar works without any plugin configuration in my POM.xml? 您可以尝试研究此问题-它可以帮助您为您的项目配置声呐: 为什么Maven命令MVN sonar:sonar可以在我的POM.xml中没有任何插件配置的情况下工作?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM