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

后端 未结 4 1302
陌清茗
陌清茗 2021-01-12 22:13

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 sendi

4条回答
  •  北海茫月
    2021-01-12 22:37

    I just downloaded the latest stable release of Jenkins (2.7.2) and tested the csrf mechanism and it seems like it worked as expected.

    For example, the following command successfully kicked off a job called "test".

    curl -X POST -u admin:test --header "Jenkins-Crumb:9c771b9e74d8d1d4b80766b63165c79d" http://localhost:8080/job/test/build
    

    That being said, your command looks like it should work. Could you try the following to narrow down the problem:

    1. Try to kick off a build using the csrf mechanism rather than using the Jenkins input pipeline. This will at least let us know if it's the csrf that's causing the problem or the plugin.
    2. Try a newer version of Jenkins (if you're not on the latest stable).

    Let me know your results.

提交回复
热议问题