在詹金斯远程触发构建 [英] Triggering builds remotely in Jenkins

查看:261
本文介绍了在詹金斯远程触发构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我曾尝试通过在提交钩子中使用此URL来触发我的Jenkins项目

I had tried to trigger my Jenkins project by using this URL in my commit hook

curl http://jenkins_server/job/job_name/build?token=TOKEN

并且没有被触发.但是,当我在网络浏览器中键入此URL时,它会触发我的构建.

and is not getting triggered. But when i type this URL in my web browser, it triggers my build.

当我在命令提示符下尝试时,出现错误

When i tried in my command prompt, I got an error

错误404

状态Co de:404

异常:
Stacktrace:

Error 404

Status Co de: 404

Exception:
Stacktrace:
(none)


由Winstone Servlet Engine v0.9生成. 2014年CEST 2014年2月22日星期二10:


Generated by Winstone Servlet Engine v0.9. 10 at Tue Apr 22 16:57:38 CEST 2014

有人可以告诉我我在做什么错吗?

Can anybody tell me what i am doing wrong??

推荐答案

首先,按照Electrawn的建议,验证运行提交挂钩的服务器是否可以实际到达Jenkins DNS.只需简单地ping或卷曲到根地址(即http://jenkins_server)即可

First, as Electrawn suggested, verify that the server where the commit hook is running can actually reach Jenkins DNS. A simple ping or curl to the root address (i.e. http://jenkins_server) would suffice

第二,如果您的Jenkins不允许匿名读取访问和构建触发(并且大多数安装都不允许),则您的问题是您的curl调用未登录.在浏览器中,尝试从Jenkins注销,然后转到相同的URL.那样有用吗?可能不是.

Secondly, if your Jenkins does not allow anonymous read access and build triggering (and most installations won't) your issue is that your curl call is not logged in. In your browser, try logging out from Jenkins and then going to the same URL. Does that work? Probably not.

要通过curl传递登录凭据,请在此处阅读:

To pass login credentials with curl, have a read here: How can a Jenkins user authentication details be "passed" to a script which uses Jenkins API to create jobs?

更简洁的答案 这里

More succinct answer here

这篇关于在詹金斯远程触发构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆