Jenkins 没有 verify/review 改变 Gerrit

Jenkins doesn't verify/review change on Gerrit

我正在尝试配置 Jenkins 的本地安装以查看在 Gerrit 上上传的更改。到目前为止,我已经让 Jenkins 检测上传的更改并构建它们(使用 Gerrit 触发器)。然而,虽然构建在 Jenkins 上成功结束,但它没有 post 对 Gerrit 的任何评论,即使它被配置为这样做。有趣的是,在 Gerrit 变更历史中,我可以看到 Jenkins 已经开始构建:

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

但仅此而已。在此之后没有显示任何结果,例如构建的成功结束等。由于我可以看到构建开始的结果,我假设我已经正确配置了审查设置,但其他原因导致了延迟。我检查了 Gerrit error_log 文件,它没有显示任何错误。可能是什么问题?

顺便说一下,我已经能够 verify/review 使用命令行作为 jenkins 编写代码。

要使验证码成为可能,您必须完成以下步骤:

  • 允许label “Verified” on Gerrit server (also see here or here);
  • 阅读 this 并确保您的作业配置正确,因为您不会构建最新的变更集;
  • 在您的 Gerrit 项目中为用户 Jenkins 授予代码审查和验证标签的访问权限;

我可以通过将 'Verified Label' 添加到 Gerrit 服务器来解决这个问题。我使用的 Gerrit 版本 (2.11.3) 明确要求您安装 Verified Label,并且默认选项设置为 No,因此我没有安装它。我只是重新安装了我的 Gerrit,这次在 Install Verified Label 上选择 Yes。如果您遇到此问题,只需重新安装 Gerrit。如果重新安装不是一个选项,请阅读:

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

一些基本信息也可以在 Jenkins plugin

中找到
    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