查看“Python-jenkins”的源代码
←
Python-jenkins
跳到导航
跳到搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
pip3 install python-jenkins =Example 1: Get version of Jenkins= This is an example showing how to connect to a Jenkins instance and retrieve the Jenkins server version. <pre> import jenkins server = jenkins.Jenkins('http://localhost:8080', username='myuser', password='mypassword') user = server.get_whoami() version = server.get_version() print('Hello %s from Jenkins %s' % (user['fullName'], version)) #Hello 运维 from Jenkins 2.263.1 </pre> = 单个copy jobs = <pre> cat copyjob.py import jenkins server = jenkins.Jenkins("http://jenkins.com/", "ops", "23456777") #user = server.get_whoami() server.copy_job('testpipe','evanpipe1') #info = server.get_job_info('testpipe') #print(info) </pre> = 多个 copy jobs = <pre> import jenkins server = jenkins.Jenkins("http://192.168.10.100:8080/", "root", "23456") #user = server.get_whoami() list = ['evan1','evan2','evan3'] for i in list: server.copy_job('testpipe',i) #server.copy_job('testpipe','evanpipe2') #server.copy_job('testpipe','evanpipe3') #server.copy_job('testpipe','evanpipe4') #info = server.get_job_info('testpipe') #print(info) </pre> [https://stackoverflow.com/questions/11480042/python-3-turn-range-to-a-list Python 3 turn range to a list] =build jobs= <pre> #!/usr/bin/python3 # -*- coding: UTF-8 -*- import jenkins server = jenkins.Jenkins("http://192.168.10.100:8080/", "root", "password") jobslist=['intra_pipe_task','intra_pipe_server'] for i in jobslist: server.build_job(i) #server.build_job('empty') </pre> =R= https://python-jenkins.readthedocs.io/en/latest/examples.html [[category:devops]] [[category:jenkins]]
返回至
Python-jenkins
。
导航菜单
个人工具
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
导航
首页
我的导航
关于我
shell
python
ops
linuxchina.net
blog.linuxchina
最近更改
随机页面
帮助
工具
链入页面
相关更改
特殊页面
页面信息