本文整理汇总了Python中jenkins.Jenkins.reconfig_job方法的典型用法代码示例。如果您正苦于以下问题:Python Jenkins.reconfig_job方法的具体用法?Python Jenkins.reconfig_job怎么用?Python Jenkins.reconfig_job使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jenkins.Jenkins
的用法示例。
在下文中一共展示了Jenkins.reconfig_job方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from jenkins import Jenkins [as 别名]
# 或者: from jenkins.Jenkins import reconfig_job [as 别名]
def run(self):
# Run the egg_info step to find our VCS url.
self.run_command('egg_info')
if not self.distribution.metadata.url:
print "This package does not appear to be in any repository, aborting."
sys.exit(1)
# Pull down jenkins package
self.fetch_build_eggs(['python_jenkins'])
from jenkins import Jenkins
print "Connecting to Jenkins at %s" % self.server
# Prompt for password or use command-line
if self.no_prompt:
if self.password is None:
print "Must specify password if no-prompt is set."
sys.exit(1)
password = self.password
else:
password = getpass.getpass("Please enter your Jenkins password: ")
jenkins = Jenkins(self.server, self.username, password)
name = self.distribution.metadata.name
cfg_xml = JENKINS_CFG_XML.safe_substitute(
name=name,
description=self.distribution.metadata.description,
repository=self.distribution.metadata.url,
email=self.distribution.metadata.author_email,
virtualenv=CONFIG.virtualenv_executable,
)
if jenkins.job_exists(name):
if not self.no_prompt:
while True:
user_input = raw_input("Job already exists, update configuration? [y/n]")
if not user_input in ('y', 'n'):
continue
break
if user_input == 'n':
return
print "Reconfiguring job at %s/job/%s" % (self.server, name)
jenkins.reconfig_job(name, cfg_xml)
else:
print "Creating job at %s/job/%s" % (self.server, name)
jenkins.create_job(name, cfg_xml)
示例2: execOnJenkins
# 需要导入模块: from jenkins import Jenkins [as 别名]
# 或者: from jenkins.Jenkins import reconfig_job [as 别名]
def execOnJenkins(self,env,testSpecifierString,mailto,execOnOneZone=True):
try:
testMgr=testManager(testSpecifierString,env['virtenvPath'])
jobModifier=modifyJOb()
modifiedjob=""
j=Jenkins('http://jenkins-ccp.citrix.com','bharatk','BharatK')
tests=testMgr.getTests()
if(tests==None):
raise Exception("found no tests to run")
while(not tests is None):
#trigger a jenkins job.
os.chdir(env['virtenvPath'])
self.logger.info("launching jenkins TestExecutor Job")
#createing testexecutorjobs for each zone.
cscfg=configGenerator.getSetupConfig(env['config_file'])
jobIdentifierList=[]
for zone in cscfg.zones:
for pod in zone.pods:
for cluster in pod.clusters:
modifiedjob=jobModifier.addTests(env['build_number'],tests)
file=open("/root/cloud-autodeploy2/newcode/"+modifiedjob,'r')
config=file.read()
file.close()
bash("rm -f /root/cloud-autodeploy2/newcode/%s"%modifiedjob)
if(not j.job_exists(modifiedjob)):
j.create_job(modifiedjob,config)
else:
j.reconfig_job(modifiedjob,config)
j.build_job(modifiedjob, {'BASEDIR':env['virtenvPath'], 'MGMT_SVR' : env['hostip'],'buildNumber':env['build_number'],'zoneName':zone.name,'hypervisor':cluster.hypervisor.lower(),'zoneType':zone.networktype,'configFileName':env['config_file'],'token':'bharat'})
jobIdentifierList.append(zone.name)
break
break
if (execOnOneZone):
break
self.waitForJobComplete(env['virtenvPath'],jobIdentifierList)
tests=testMgr.getTests()
j.delete_job(modifiedjob)
jobIdentifierList=[]
bugLoggerData=[]
time.sleep(30)
for zone in cscfg.zones:
self.logger.info(zone.name)
for pod in zone.pods:
for cluster in pod.clusters:
self.logger.info("creating a jeknins job to generate results and email notfication for hypervisor %s and zone %s"%(cluster.hypervisor, zone.name))
modifiedjob=jobModifier.modifyReportGenerator(env['build_number']+"_"+zone.name+"_"+cluster.hypervisor, mailto)
jobname=modifiedjob
file=open("/root/cloud-autodeploy2/newcode/"+modifiedjob,'r')
config=file.read()
file.close()
j.create_job(modifiedjob,config)
j.build_job(modifiedjob, {'buildNumber':env['build_number'],'BuildNo':env['build_number'], 'MGMT_SVR' : env['hostip'], 'BASEDIR':env['virtenvPath'], 'version':env['version'], 'BranchInfo':env['version'],\
'GitRepoUrl':env['repo_url'],'GitCommitId':env['commit_id'], 'CIRunStartDateTime':env['startTime'],'CIRunEndDateTime':time.strftime("%c"), 'WikiLinks':'https://cwiki.apache.org/confluence/display/CLOUDSTACK/Infrastructure%2CCI%2CSimulator%2CAutomation+Changes','hypervisor':cluster.hypervisor.lower(), 'HyperVisorInfo':cluster.hypervisor.lower(), 'zoneName':zone.name, 'BuildReport':"http://jenkins-ccp.citrix.com/job/"+jobname+"/1/testReport/",'token':'bharat'})
jobIdentifierList.append("report_"+zone.name)
jobDetails={"job_name":modifiedjob,"related_data_path":env['virtenvPath']}
self.resourceMgr.addJobDetails(jobDetails)
bugLoggerData.append({'hypervisor':cluster.hypervisor.lower(), 'branch':env['version'],'logname':cluster.hypervisor.lower()+'__Log_'+env['build_number'], 'type':'BVT'})
self.logger.info("bug logger data in zone looop %s"%bugLoggerData)
break
break
if (execOnOneZone):
#env['hypervisor':cluster.hypervisor.lower()]
break
self.logger.info("job identifier list", jobIdentifierList)
self.waitForJobComplete(env['virtenvPath'],jobIdentifierList)
#self.logger.info("deleting the reporter job on jenkins job_name=%s",jobname)
#j.delete_job(jobname)
self.logger.info("cleaning up the workspace")
bash("rm -f /root/cloud-autodeploy2/newcode/%s"%modifiedjob)
self.logger.info("running bug logger")
#self.runBugLogger(bugLoggerData)
#os.system("rm -rf %s"%(self.jenkinsWorkspace+"/"+jobname))
except Exception, e:
self.logger.error(e)