jenkins API对接

  1. 鉴权
    jenkins使用Basic64鉴权
    header的格式为
Authorization: Basic xxxxxxxxxx

2.带参数调用流水线。调用成功后,jenkins 会返回一个queueid

POST http://{{URL}}:{{PORT}}/job/test_team/job/test/job/testcase-pytest-pipeline-customer/buildWithParameters
Authorization: Basic xxxxxxxxxx
Content-Type: application/x-www-form-urlencoded

{   "parameter":[{
    "name": "caseServerity",
    "value": "normal"},
    {
    "name": "project",
    "value": "ddm"
    }  
] }

3.调用流水线后,通过queueid,可以调用api返回得到测试结果的地址,和一个流水线的序号

GET http://{{URL}}:{{PORT}}//queue/item/{{queueid}}/api/json
Authorization: Basic xxxxxxxxxx
Content-Type: application/x-www-form-urlencoded

4.通过如下api,可以查看流水线执行状态

GET http://{{URL}}:{{PORT}}/job/test_team/job/{{pipelinename}}/api/json
Authorization: Basic xxxxxxxxxx
Content-Type: application/x-www-form-urlencoded

你可能感兴趣的:(jenkins API对接)