Reputation: 18841
I'm calling a Jenkins job remotely using a curl command, like this:
C:\Windows\system32>"C:\Program Files (x86)\Git\usr\bin\curl.exe" -X POST -u [user]/[password] http://[server]:8080/job/[job]/buildWithParameters?NODE=[node]
The Jenkins job is never run. Instead on the command line, the command returns a big chunk of XML (I cut out most of the middle section, but it's mostly references to js and css files):
<!DOCTYPE html><html><head data-rooturl="" resURL="/static/a7b46c37" data-resu
rl="/static/a7b46c37">
<title>Jenkins</title><link rel="stylesheet" type="text/css" href="/static/a
7b46c37/css/layout-common.css" /><link rel="stylesheet" type="text/css" href="/s
...
function showTranslationDialog() {
if(!translation.launchDialog)
loadScript("/static/a7b46c37/plugin/translation/dialog.js");
else
translation.launchDialog();
return false;
}</script></div></div></div></footer></body></html>
Upvotes: 1
Views: 278
Reputation: 1013
To authenticate with basic auth, you should use:
-u [user]:[password]
instead of:
-u [user]/[password]
if the job you're trying to run has it's own token, add the query param to the end of the url:
&token=[token]
Upvotes: 0
Reputation: 18841
The user didn't have Build permission on the job. Once I gave it Build permission, the command didn't return any XML, and the Jenkins job ran fine.
Upvotes: 1