【问题标题】:Jenkins github pull request builder plugin is not posting to githubJenkins github 拉取请求构建器插件未发布到 github
【发布时间】:2013-12-06 21:36:41
【问题描述】:

我已经配置了 Jenkins Github Pull-Request builder 插件来构建我机构成员提出的每个 pull-request。它就像一个魅力。

但是,构建并没有像在这个漂亮的post 中显示的那样将构建状态报告回 github。我还尝试选中“更新提交状态失败时使用 cmets 报告结果”框,但我仍然没有在 github 上得到任何回复。

我在 GitHub 上创建了一个机器人用户,并为其授予了对 repo 的推送和管理权限。

我的 Jenkins 服务器位于防火墙后面,但由于它正在正常构建并检测(通过轮询)对 github 存储库的更改,我认为这不是问题。

其他人有这个问题吗?你是怎么解决的?

这是我的控制台输出的转储(为便于阅读而压缩)

Started by an SCM change
Building in workspace 
Fetching changes from the remote Git repository
Fetching upstream changes from repo
Seen branch in repository origin/HEAD
Seen branch in repository origin/master
Seen branch in repository origin/pr/1/head
Seen branch in repository origin/pr/1/merge
Seen branch in repository origin/pr/10/head
[…]
Seen branch in repository origin/pr/9/head
Seen branch in repository origin/pr/9/merge
Seen 33 remote branches
Checking out Revision 9b4d45ee3a2d265a1268c2931e7b2bcb738e1c87 (origin/pr/16/merge)
First time build. Skipping changelog.
...found 160 targets...
...updating 21 targets...
**passed** test/bin/test.test/gcc-4.8.1/debug/test.test
[xUnit] [INFO] - Starting to record.
[xUnit] [INFO] - Processing BoostTest-1.x (default)
[xUnit] [INFO] - Check 'Failed Tests' threshold.
[xUnit] [INFO] - Check 'Skipped Tests' threshold.
[xUnit] [INFO] - Setting the build status to SUCCESS
[xUnit] [INFO] - Stopping recording.
Finished: SUCCESS

【问题讨论】:

    标签: github jenkins jenkins-plugins pull-request


    【解决方案1】:

    查看 Jenkins LOGS 后,我学到了一些东西:

    1. 这个插件(github pull-request builder)完全替代了所有其他的构建触发器(包括 git 和 SCM poll)。我同时使用了这三个,当我认为这个插件可以正常工作是因为它构建正确时,实际上是其他触发器。
    2. 必须在 github 插件上设置您的项目 github URL。这个插件依赖于 github 插件来工作。这就是阻止它在我的配置中工作的原因。

    修复 #2 后,您可以从 SCM Poll 和 Git 中删除触发器,以确保 pull-request 插件正在触发构建。当它这样做时,它实际上会在 Jenkins 中将拉取请求的链接添加到活动源(非常好),并正确更新 github 上的状态。

    【讨论】:

    • 我有同样的问题,但不确定你的意思是什么:“你必须在 github 插件上设置你的项目 github URL。” - 是在工作配置页面上吗?我在作业配置中设置了 github URL 和存储库 URL。我也有 GitHub 拉取请求构建器作为单个构建触发器,但仍然有同样的问题。查看 jenkins 日志,我发现问题是:无法在 GitHub 上更新 Pull Request 的提交状态。 java.io.FileNotFoundException: api.github.com/repos/XXX/YYY/statuses/SHA
    • 您的日志中还有什么?我从未收到此错误,但日志可能有助于确定您的情况出了什么问题。这似乎是一个身份验证问题,可能吗?
    • 问题已修复。问题是在 Jenkins 设置中,我使用了访问令牌,但访问令牌是为从存储库所有者中删除的用户生成的,因此不再有权发表评论。如果您遇到类似的错误,请按照说明在此处创建访问令牌:wiki.jenkins-ci.org/display/JENKINS/… 注意:我必须重新启动 Jenkins 才能使用新的访问令牌对 Guthub 进行这项工作
    • 您是否知道$sha1 变量是否设置为生成拉取请求的提交?虽然文档说使用该变量,但我发现它没有设置(并发布了另一个关于它的问题)。
    • 我不知道,对不起
    猜你喜欢
    • 2018-09-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-12
    • 1970-01-01
    • 2021-01-10
    • 2016-07-21
    • 1970-01-01
    相关资源
    最近更新 更多