简体   繁体   English

Jenkins没有验证/审查Gerrit的变更

[英]Jenkins doesn't verify/review change on Gerrit

I'm trying to configure a local installation of Jenkins to review uploaded changes on Gerrit. 我正在尝试配置Jenkins的本地安装以查看Gerrit上传的更改。 So far, I've gotten Jenkins to detect uploaded changes and build them (using Gerrit Trigger). 到目前为止,我已经让Jenkins检测上传的更改并构建它们(使用Gerrit Trigger)。 However, while the build concludes successfully on Jenkins, it doesn't post any reviews on Gerrit, even though it is configured to do so. 但是,虽然构建在Jenkins上成功结束,但它不会在Gerrit上发布任何评论,即使它已配置为这样做。 Interestingly, in Gerrit change history, I can see Jenkins having started a build: 有趣的是,在Gerrit更改历史中,我可以看到Jenkins已经开始构建:

Jenkins    Patch Set 1: Build Started http://localhost:8080/job/TestProject/70/

but that's it. 但就是这样。 No results are shown after this, like successful conclusion of the build etc. Since I can see the build started result, I'm assuming I've configured the review settings correctly, but something else is causing a hold up. 在此之后没有显示任何结果,例如成功完成构建等。因为我可以看到构建开始结果,我假设我已经正确配置了审阅设置,但是其他东西导致了阻碍。 I've checked in the Gerrit error_log file and it doesn't show any errors. 我已经检查了Gerrit error_log文件,它没有显示任何错误。 What maybe the issue? 可能是什么问题?

By the way I've been able to verify/review the code as jenkins using the command line. 顺便说一下,我已经能够使用命令行验证/查看代码作为jenkins。

To make code verification possible, you have to go through the following steps: 要使代码验证成为可能,您必须执行以下步骤:

  • Allow label “Verified” on Gerrit server (also see here or here ); 允许在Gerrit服务器上标记“已验证” (也可在此处此处查看 );
  • Read this and make sure your job configured properly, because you will not build latest changesets instead; 阅读此内容并确保正确配置您的作业,因为您不会构建最新的更改集;
  • Give access to labels Code-Review and Verified in your Gerrit project for user Jenkins; 在用户Jenkins的Gerrit项目中访问标签Code-Review和Verified;

I was able to resolve this by adding the 'Verified Label' to the Gerrit Server. 我能够通过将“已验证标签”添加到Gerrit服务器来解决此问题。 The version of Gerrit I used (2.11.3) explicitly asks you to install the Verified Label, and the default option is set at No and as a result I didn't install it. 我使用的Gerrit版本(2.11.3)明确要求您安装验证标签,默认选项设置为No,因此我没有安装它。 I simply reinstalled my Gerrit, this time choosing Yes on Install Verified Label. 我只是重新安装了我的Gerrit,这次在安装验证标签上选择是。 If you're facing this issue, simply reinstall your Gerrit. 如果您遇到此问题,只需重新安装Gerrit即可。 If re-installation is not an option, read this: 如果不能重新安装,请阅读:

http://blog.bruin.sg/2013/04/how-to-edit-the-project-config-for-all-projects-in-gerrit/ http://blog.bruin.sg/2013/04/how-to-edit-the-project-config-for-all-projects-in-gerrit/

Some basic information can be found also in Jenkins plugin Jenkins插件中也可以找到一些基本信息

Create the profile through in Gerrit web interface for your Jenkins    user, and set up a SSH key for that user.
    Gerrit web interface > Admin > Groups > Non-Interactive Users > Add your    jenkins user.
    Admin > Projects > ... > Access > Edit
    Reference: refs/*
    Read: ALLOW for Non-Interactive Users
    Reference: refs/heads/*
    Label Code-Review: -1, +1 for Non-Interactive Users
    Label Verified: -1, +1 for Non-Interactive Users

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

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