本文整理汇总了Python中jenkins.Jenkins.get_job_config方法的典型用法代码示例。如果您正苦于以下问题:Python Jenkins.get_job_config方法的具体用法?Python Jenkins.get_job_config怎么用?Python Jenkins.get_job_config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jenkins.Jenkins
的用法示例。
在下文中一共展示了Jenkins.get_job_config方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_jenkins_job
# 需要导入模块: from jenkins import Jenkins [as 别名]
# 或者: from jenkins.Jenkins import get_job_config [as 别名]
def create_jenkins_job(init_job_config, job_name):
"""
Create new job by getting config file
from existing job
"""
j = Jenkins("http://localhost:8080")
str_config = j.get_job_config(init_job_config)
if j.job_exists(job_name) == False:
j.create_job(job_name, str_config)
示例2: JenkinsConnection
# 需要导入模块: from jenkins import Jenkins [as 别名]
# 或者: from jenkins.Jenkins import get_job_config [as 别名]
class JenkinsConnection(object):
def __init__(self, username, password):
self.jenkins = Jenkins(URL, username=username, password=password)
def store_job(self, job_name):
job_config = self.jenkins.get_job_config(job_name)
with open(self._config_filename(job_name), 'w') as config:
config.write(job_config)
def get_jobs(self, view):
raw_config = self.jenkins.get_view_config(view)
config = ET.fromstring(raw_config)
jobs = [j.text for j in config.find('jobNames').getchildren()]
return filter(None, jobs)
示例3: JenkinsControl
# 需要导入模块: from jenkins import Jenkins [as 别名]
# 或者: from jenkins.Jenkins import get_job_config [as 别名]
class JenkinsControl(object):
war=pjoin(here, 'tmp/jenkins.war')
cli=pjoin(here, 'tmp/jenkins-cli.jar')
home=pjoin(here, 'tmp/jenkins')
def __init__(self, addr='127.0.0.1:60888', cport='60887'):
self.addr, self.port = addr.split(':')
self.url = 'http://%s' % addr
self.py = Jenkins(self.url)
def start_server(self):
cmd = pjoin(here, './bin/start-jenkins.sh 1>/dev/null 2>&1')
env={'JENKINS_HOME' : self.home,
'JENKINS_PORT' : self.port,
'JENKINS_CPORT' : self.cport,
'JENKINS_ADDR' : self.addr}
check_call(cmd, shell=True, env=env)
def shutdown_server(self):
cmd = 'echo 0 | nc %s %s' % (self.addr, self.cport)
check_call(cmd, shell=True)
def clean_home(self):
rmtree(self.home)
def createjob(self, name, configxml_fn):
self.py.create_job(name, open(configxml_fn).read())
def getjobs(self):
return {i['name'] : i for i in self.py.get_jobs()}
def enabled(self, name):
return self.py.get_job_info(name)['buildable']
def job_etree(self, job):
res = self.py.get_job_config(job)
res = etree.fromstring(res)
return res