jenkins api使用简介
Posted bingoTest
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jenkins api使用简介相关的知识,希望对你有一定的参考价值。
https://wiki.jenkins-ci.org/display/JENKINS/Bash+Job+Clone+script
curl 命令使用API实践:
1.创建
curl -X POST http://www.xxx.xxx/jenkins/createItem?name=JavaStd --user test:test --data-binary "javastd.config.xml" -H "Content-Type: text/xml"
2.禁用
curl -X POST http://www.xxx.xxx/jenkins/job/JavaStd/disable --user test:test
3.启用
curl -X POST http://www.xxx.xxx/jenkins/job/JavaStd/enable --user test:test
4.删除
curl -X POST http://www.xxx.xxx/jenkins/job/JavaStd/doDelete --user test:test
5.获取项目描述
curl -X GET http://www.xxx.xxx/jenkins/job/JavaStd/description --user test:test
6.获取配置文件
curl -X GET http://www.xxx.xxx/jenkins/job/JavaStd/config.xml --user test:test
7.触发SCM检查
curl -X GET http://www.xxx.xxx/jenkins/job/JavaStd/polling --user test:test
8.普通触发
curl -X GET http://www.xxx.xxx/jenkins/job/JavaStd/build --user test:test
9.带参数触发
curl -X GET "http://www.xxx.xxx/jenkins/job/helloworld-freestyle/buildWithParameters?bAllTest=&Choices=2&strParam=abc" --user test:test
10.带参数和补丁触发
curl -X POST "http://www.xxx.xxx/jenkins/job/helloworld-freestyle/buildWithParameters?bAllTest=&Choices=2&strParam=abc" --user test:test -F "action=upload" -F "patch.diff=@OtherTest.java.patch"
注:带补丁触发需要先安装补丁插件,并设置项目的补丁参数
以上是关于jenkins api使用简介的主要内容,如果未能解决你的问题,请参考以下文章
持续集成Jenkins Jenkins API的使用(更新中)