我们使用 Jenkins (1.614) 并使用 Git 作为版本控制工具。 Git 插件版本是 2.3.5。我试图在每次 checkin 后仅触发构建,因为连续轮询的成本太高。我尝试了各种链接中描述的以下方法,但它不起作用:
- 启用“轮询 SCM”并分配一个虚拟值。我也尝试过不分配任何值。
- 在接收后 Hook 中添加了以下行:
curl http://jenkins_url:9099/jenkins/git/notifyCommit?url=ssh://gitolite@git_server/TestRepo
- 现在,如果我提交一些更改,我会在推送过程中收到以下消息:
$ git push origin release-test
Counting objects: 20, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 308 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Commit ID: 3a9cddadasd
remote: Returning result 0
remote: % Total % Received % Xferd Average Speed Time Time Time Current
remote: Dload Upload Total Spent Left Speed
remote: 124 124 124 124 0 0 30 0 0:00:04 0:00:04 --:--:-- 497
remote: Scheduled polling of Poll_Job
remote: No Git consumers using SCM API plugin for: ssh://gitolite@git_server/TestRepo
- 当我查看 Git 轮询日志时,我注意到以下内容:
Started on Jun 10, 2015 6:42:04 PM
No existing build. Scheduling a new one.
Done. Took 0 ms
Changes found
我确实看到每次此类轮询后构建 # 都会增加几秒钟,但“构建历史记录”仍然为空,如下所示。不会执行构建过程中的任何步骤。
有任何输入说明为什么构建没有按预期触发吗?
最佳答案
查看构建“Git 轮询日志”,它可能会指出问题所在。我遇到了类似的问题,其中由 Git 的“Poll SCM”触发的 Maven 作业停止触发新的构建。显然原因是:
ERROR: Failed to record SCM polling ... undefined method `add' for nil:NilClass at Jenkins::Model::Build.initialize(C:/Jenkins/plugins/nodeofflinenotification/ ...
然后我注意到“Node Offline notification Plugin”已被弃用,因此我卸载了它(并安装了“Mail Watcher Plugin”),SCM 轮询再次工作。
关于git - 无法使用 'Poll SCM' 和 Git notifyCommit 选项触发构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30759944/