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
Does the server running curl have a hosts/DNS entry back to 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
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