且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何通过REST API创建jenkins凭证?

更新时间:2022-06-26 09:39:12

这个问题使我花了一段时间才能弄清楚,进行了很多挖掘,因此,如果有人需要,我决定将解决方案留在这里.

This issue took me a while to figure, a lot of digging around, so I decided to let the solution here, if someone else needs it.

curl -X POST 'http://user:token@jenkins_server:8080/credentials/store/system/domain/_/createCredentials' \
--data-urlencode 'json={
  "": "0",
  "credentials": {
    "scope": "GLOBAL",
    "id": "identification",
    "username": "manu",
    "password": "bar",
    "description": "linda",
    "$class": "com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl"
  }
}'