Trigger build via URL gives me no crumb included in request error

后端 未结 2 729
时光取名叫无心
时光取名叫无心 2021-01-21 05:19

I\'ve been trying to trigger a build via the Jenkins API so far with no success. I configured a job on \'Trigger builds remotely\' and set a token, \'abc\'.

Then in post

相关标签:
2条回答
  • 2021-01-21 05:33

    Pass in POST headers, "Jenkins-Crumb:5740ac1b614ca59f5dd5ef151b2895b3".

    Your Crumb can be obtained from the URL http://jenkins:8080/crumbIssuer/api/xml

    In the POST body, use the appropriate Jenkins XML API request.

    Here is my Postman images with parameters:

    0 讨论(0)
  • 2021-01-21 05:35

    This worked for me:

    Obtain crumb

    $ wget -q --auth-no-challenge --user yourUserName --password yourPassword--output-document - 'http://myJenkins:8080/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,":",//crumb)'

    Now run the Jenkins job

    $ curl -I -X POST http://yourUserName:yourPassword@myJenkins:8080/job/JOBName/build -H "Jenkins-Crumb:44e7038af70da95a47403c3bed5q10f8"

    HTTP/1.1 201 Created 
    Date: Fri, 28 July 2017 09:15:45 GMT
    X-Content-Type-Options: nosniff 
    Location: http://myJenkins:8080/queue/item/17/
    Content-Length: 0
    
    0 讨论(0)
提交回复
热议问题