python-jenkins 操作

 Python-Jenkins Doc:http://python-jenkins.readthedocs.io/en/latest/index.html

实例代码:

 1 import jenkins
 2 
 3 jenkins_server_url = 'http://10.xxx:60000'
 4 user_id = 'xxx'
 5 api_token = 'xxx09409aa455912bf77972782c4fcda9e'
 6 server = jenkins.Jenkins(jenkins_server_url, username=user_id, password=api_token)
 7 job_name = 'TESTs'
 8 # number = server.get_job_info(job_name)['lastBuild']['number']
 9 # 执行job构建
10 server.build_job(job_name)

 

posted @ 2019-08-22 16:50  我要成为女技术宅  阅读(729)  评论(0编辑  收藏  举报