Jenkins 作业通知失败,并显示“没有 git 消费者用于 URI ...”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23000199/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Jenkins job notification fails with "No git consumers for URI ..."
提问by Quirin
I want to set up a post-receive
git
hook that notify jenkins
about the change, but no job is triggered in jenkins
.
我想设置一个post-receive
git
挂钩来通知jenkins
更改,但在jenkins
.
My post-receive
hook looks like this:
我的post-receive
钩子看起来像这样:
curl http://localhost/jenkins/git/notifyCommit?url=<git_repository_url>
If I issue the command in terminal, I get the following message:
如果我在终端中发出命令,我会收到以下消息:
"No git consumers for URI..."
I have a jenkins job that connected to Git Source Code Management, repository URL is given as well as branches: */master
我有一个连接到 Git 源代码管理的 jenkins 工作,给出了存储库 URL 以及分支: */master
I've searched for this problem, but I've found nothing useful related to: "No git consumers for URI"
我已经搜索了这个问题,但我没有发现与以下内容相关的任何有用信息:“没有 URI 的 git 消费者”
I use:
我用:
- LinuxMint
- Apache 2.4.6
- git 1.8.3.2
- curl 7.32.0
- Jenkins 1.532.2
- LinuxMint
- 阿帕奇 2.4.6
- 混帐 1.8.3.2
- 卷曲 7.32.0
- 詹金斯 1.532.2
I have a proxy setup in apache:
我在 apache 中有一个代理设置:
<Proxy *>
Order deny,allow
deny from all
allow from 127.0.0.1
</Proxy>
The git repository is bare
.
git 存储库是bare
.
回答by idontevenseethecode
Enable SCM polling for each project you want to notify:
为您要通知的每个项目启用 SCM 轮询:
- Go to the Dashboard.
- Click on your project.
- Click Configure.
- Under Build Triggerscheck the box for Poll SCM.
- Repeat for any other projects.
- 转到仪表板。
- 单击您的项目。
- 单击配置。
- 在Build Triggers 下,选中Poll SCM框。
- 重复任何其他项目。
The notification you send tells Jenkins to poll the repository, so projects will only respond if SCM polling is enabled.
您发送的通知告诉 Jenkins 轮询存储库,因此项目仅在启用 SCM 轮询时才会响应。
回答by monitorjbl
The message No git consumers for URI
always shows up, you should be worried if you see No git jobs using repository
. The response will contain a list of jobs scheduled for polling, so as long as you see them, the polling was triggered.
消息No git consumers for URI
总是出现,如果你看到你应该担心No git jobs using repository
。响应将包含计划进行轮询的作业列表,因此只要您看到它们,就会触发轮询。
That said you might want to check that polling is actually doingsomething. If you go into a job configured with Git, you can see a link to the Git Polling Log on the left. In there you'll be able to see if the trigger actually did anything and, more crucially, if there was an error.
也就是说,您可能想检查轮询实际上是否在执行某些操作。如果您进入使用 Git 配置的作业,您可以在左侧看到指向 Git 轮询日志的链接。在那里你将能够看到触发器是否真的做了任何事情,更重要的是,如果有错误。
I had an issue similar to this, and it took me a while to figure out that my Git was misconfigured. My job will build fine when manually triggered, but the polling trigger would use a different path to the Git binary and fail. I ended up having to define the Git path to fix my issue.
我遇到了类似的问题,我花了一段时间才发现我的 Git 配置错误。我的工作在手动触发时会很好地构建,但轮询触发器将使用不同的 Git 二进制文件路径并失败。我最终不得不定义 Git 路径来解决我的问题。
回答by dhj
I had to take the following steps:
我不得不采取以下步骤:
- Enable SCM Pollingas answered by @angstadt530
- project->configure->"Build Triggers"->"Enable SCM Polling" ... check it
- Check the Git Polling Logas answered by @monitorjbl
- project->"Git Polling Log" ... to identify #3
- Force polling using workspace
- project->configure->"Source Code Management"->"Additional Behaviors"->add->"Force polling using workspace" ... select it from the pulldown.
- 按照@angstadt530 的回答
启用SCM 轮询
- project->configure->"Build Triggers"->"Enable SCM Polling" ...检查它
- 检查@monitorjbl 回答
的Git 轮询日志
- project->"Git Polling Log" ... 识别 #3
- 使用工作区强制轮询
- project->configure->"Source Code Management"->"Additional Behaviors"->add->"Force polling using workspace" ...从下拉列表中选择它。
After completing #1 in addition to "No git consumers for URI gitRepoURI" I also got, "Scheduled Polling of projectName".
除了“URI gitRepoURI 没有 git 消费者”之外,在完成 #1 之后,我还得到了“项目名称的计划轮询”。
However, looking at the Git Polling Log I found the error message: Can not run program "C:\Program Files (x86)\Git\bin\git.exe": error=2, No such file or directory
但是,查看 Git 轮询日志我发现错误消息:无法运行程序“C:\Program Files (x86)\Git\bin\git.exe”: error=2, No such file or directory
To fix this error I had to configure source code management to Force polling using workspace (#3). I'm not sure why, because manually initiated builds work fine. Maybe a bug -- maybe the mixing of a linux server and a windows slave. But either way, this finally fixed it for me. Hope it helps.
为了解决这个错误,我必须将源代码管理配置为使用工作区(#3)强制轮询。我不知道为什么,因为手动启动的构建工作正常。也许是一个错误——也许是 linux 服务器和 windows 从站的混合。但无论如何,这最终为我解决了这个问题。希望能帮助到你。