简体   繁体   中英

Triggering builds remotely in 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

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

Error 404

Status Co de: 404

Exception:
Stacktrace:
 (none) \n

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??

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 (ie http://jenkins_server ) would suffice

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.

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

运行curl的服务器是否将主机/ DNS条目返回给jenkins_server?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM