我查到的相关API有两套,我主要用的是python-jenkins。
https://pypi.python.org/pypi/python-jenkins/
按语法调用即可。。。
import jenkins server = jenkins.Jenkins(‘http://1.1.1.1/‘, username=‘user‘, password=‘pwd‘) version = server.get_version() # print version def demo(): result = server.build_job(‘jobname‘, {‘SYSTEM‘: ‘arg1‘, ‘SERVERNAME‘: ‘arg2‘, ‘PORT‘: ‘arg3‘, ‘BRANCH_TO_BUILD‘: ‘arg4‘, ‘VERSION‘: ‘arg5‘ }) return result if __name__ == "__main__": print demo()
时间: 2024-11-05 23:32:20