#!/usr/bin/python
#coding=UTF-8
“”"
输入:jenkins服务器的地址,用户名和密码
输出:已定义的job的列表
“”"
import datetime, time
from jenkinsapi.jenkins import *
from jenkinsapi.job import *
from jenkinsapi.build import Build
def Url_Get_Job_List(url=‘jenkins address’, username=‘username’, password=‘pwd’):
jenkins = Jenkins(url, username, password)
count = 0
for job_name in jenkins.keys():
my_job = jenkins.get_job(job_name)
count = count + 1
#print “Job” + str(count) + " : "+job_name
print job_name
if name == “main”:
Url_Get_Job_List()
自动化脚本获取所有jenkins job名列表
最新推荐文章于 2024-09-11 21:56:34 发布