Hello everyone.

Recently I have been testing Jenkins Pipeline. So far it seems like a 
wonderful idea, however as beautiful as it looks I run into a problem, a 
deal-breaker for me as it turns out. 

I have Jenkins pipeline with an Input step, and I would like to submit this 
input(single string argument) via a script. 

So far I am trying with curl, ideally I'll be sending it via Python 
requests library. This should be an easy POST request, however with CSRF it 
becomes tricky. I've obtained Jenkins-Crumb (using curl in this case, from 
the same machine and same bash session), but still can't send the content...

I'm sending 
Jenkins-Crumb:XXX header

just like it is explained at 
https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API

my request looks like this:

curl -vvv -X POST -H "Jenkins-Crumb:${JENKINS_CRUMB}" -d 
'json="{"parameter":{"name":"${PARAM_NAME}","value":"asd"},"Jenkins-Crumb":"${JENKINS_CRUMB}"}"'
 
'http://${JENKINS_URL}/job/${JOB_NAME}/${BUILD_NR}/input/' 



I have also tried using 
--form json=
'{"parameter":{"name":"result_payload","value":"asd"},"Jenkins-Crumb":"${JENKINS_CRUMB}"}'


None of which succeeded.

The URL I'm POSTing at is the same, as the one linked in build log (Console 
output):
http://${JENKINS_URL}/job/${JOB_NAME}/${BUILD_NR}/input/


What am I missing to successfully fill in the "Input" step of Jenkins 
Pipeline?

Any help will be highly appreciated!

Best regards,
Miłosz Tyborowski.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/6bee8bd4-6321-495a-a6b1-78eecb92c3ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to