美文网首页
jenkins通过命令行启动其他job

jenkins通过命令行启动其他job

作者: 非鱼2018 | 来源:发表于2019-06-02 10:59 被阅读0次

1.使用curl

curl -X POST http://localhost:8080/jenkins/job/demo2/build --user admin:123456

2.使用jenkins CLI,需要先下载jenkins-cli.jar包

先下载jar包,

wget http://localhost:8080/jenkins/jnlpJars/jenkins-cli.jar

java -jar jenkins-cli.jar -s http://localhost:8080/jenkins  build demo2 -p id=123 -p name=autotest --username admin2 --password 123456

3.使用python api

安装pip install python-jenkins

>>> import jenkins

>>> jenkins.Jenkins("http://localhost:8080/jenkins","admin","123456")

<jenkins.Jenkins object at 0x000000000293BB00>

>>> jenkinobj=jenkins.Jenkins("http://localhost:8080/jenkins","admin","123456")

>>> jenkinobj.build_job

<bound method Jenkins.build_job of <jenkins.Jenkins object at 0x00000000033A7390>>

>>> jenkinobj.build_job("demo2")

带参数的:

>>> jenkinobj.build_job("demo2",dict1)

21

相关文章

网友评论

      本文标题:jenkins通过命令行启动其他job

      本文链接:https://www.haomeiwen.com/subject/dhxxxctx.html