【发布时间】:2016-10-11 19:07:17
【问题描述】:
我正在尝试设置 jenkins,以便当检测到对 repo 的提交时,jenkins 中的构建会自动触发。 我一直在看这篇文章:How can I make Jenkins CI with git trigger on pushes to master?
但我不清楚我在哪里创建了 git hook “post-receive”。 到目前为止,我已经尝试了两个不同的地方:
- 在 jenkins 服务器上,在我使用指定的 git 存储库设置这个新项目时为我自动创建的工作区文件夹中。
- 在我用来为此存储库进行编码更改的开发人员工作站上。
两者都没有工作。 这是 post-receive 文件的样子:
me@jenkinslab:/var/lib/jenkins/jobs/test git repo/workspace/.git/hooks$ cat post-receive
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".
curl http://10.1.1.11:8080/jenkins/git/notifyCommit?url=http://git.someinternaldomain.net/cgit/testing.git[&branches=branch1[,branch2]*][&sha1=<commit ID>]
除了创建此文件之外,在我的 jenkins 项目中,我在“构建触发器”部分下选中了“轮询 SCM”选项,但就计划定义而言没有任何内容。
你能告诉我我错过了什么吗?
请,谢谢。
【问题讨论】: