curl - Jenkins input pipeline step filled via POST with CSRF - howto? -


i have jenkins pipeline input step, , submit input(single string argument) via script. far trying curl, ideally i'll sending via python requests library. should easy post request, csrf becomes tricky. i've obtained jenkins-crumb (using curl in case, same machine , same bash session), still can't send content...

i'm sending jenkins-crumb:xxx header, explained @ https://wiki.jenkins-ci.org/display/jenkins/remote+access+api

my request looks this:

curl -vvv -x post --user '${user}:${api_key}' -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/' 

the url i'm posting @ same, 1 linked in build log (console output).

there easier way, call proceedempty url jobs:

curl -x post -h "jenkins-crumb:${jenkins_crumb}" http://${jenkins_url}/job/${job_name}/${build_id}/input/${input_id}/proceedempty 

there no need pass in body data.

to abort, use:

curl -x post -h "jenkins-crumb:${jenkins_crumb}" http://${jenkins_url}/job/${job_name}/${build_id}/input/${input_id}/abort 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -