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
Post a Comment