当前位置: 首页>>代码示例>>Python>>正文


Python Jenkins.delete_job方法代码示例

本文整理汇总了Python中jenkins.Jenkins.delete_job方法的典型用法代码示例。如果您正苦于以下问题:Python Jenkins.delete_job方法的具体用法?Python Jenkins.delete_job怎么用?Python Jenkins.delete_job使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jenkins.Jenkins的用法示例。


在下文中一共展示了Jenkins.delete_job方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: deleteJobs

# 需要导入模块: from jenkins import Jenkins [as 别名]
# 或者: from jenkins.Jenkins import delete_job [as 别名]
 def deleteJobs(self):
     j=Jenkins('http://jenkins-ccp.citrix.com','talluri','vmops.com')
     for i in range(757,918):
        print "deleting job %s"%("report_generator_"+str(i)+"_zone-xen_XenServer.xml")
        try:
           j.delete_job("report_generator_"+str(i)+"_zone-xen_XenServer.xml")
        except Exception,e:
            print e
            pass     
开发者ID:swill,项目名称:cloudstack-automation,代码行数:11,代码来源:jenkinsJob.py

示例2: deleteJobs

# 需要导入模块: from jenkins import Jenkins [as 别名]
# 或者: from jenkins.Jenkins import delete_job [as 别名]
 def deleteJobs(self,jobList):
     j=Jenkins('http://jenkins-ccp.citrix.com','bharatk','BharatK')
     for jobdetail in jobList:
         try:
            print "deleteing job %s"%jobdetail[0]
            j.delete_job(jobdetail[0])
         except Exception,e:
              # try:
              #   j.delete_job(jobdetail[0].replace("Sandbox-simulator_simula","Sandbox-simulator_simul").replace("Sandbox-simulator_simul","Sandbox-simulator_simulator.xml"))
              #    print "deleting job %s"%jobdetail[0].replace("Sandbox-simulator_simula","Sandbox-simulator_simul").replace("Sandbox-simulator_simul","Sandbox-simulator_simulator") 
              # except Exception,e:
              print e
         print "deleting job %s"%jobdetail[0]
         self.resourceMgr.removeJob(jobdetail[0])
         print "deleted job %s"%jobdetail[0]
         print "cleaning up related data"
         os.system("rm -rf %s"%jobdetail[1])
         os.system("rm -rf /automation/jenkins/workspace/%s"%jobdetail[0])
开发者ID:swill,项目名称:cloudstack-automation,代码行数:20,代码来源:jenkinsGarbageCollector.py

示例3: __init__

# 需要导入模块: from jenkins import Jenkins [as 别名]
# 或者: from jenkins.Jenkins import delete_job [as 别名]
class jenKinsJob:
    def __init__(self):
        self.j = Jenkins("http://jenkins-ccp.citrix.com", "bharatk", "BharatK")
        self.resourceMgr = resourceManager()
        self.logger = logging.getLogger("jenkinsJob")

    def deleteJob(self, jobList):
        print "***********", jobList
        for jobentity in jobList:
            try:
                self.logger.info("deleteing job %s" % jobentity["job_name"])
                self.j.delete_job(jobentity["job_name"])
            except Exception, e:
                # try:
                #   j.delete_job(jobentity[0].replace("Sandbox-simulator_simula","Sandbox-simulator_simul").replace("Sandbox-simulator_simul","Sandbox-simulator_simulator.xml"))
                #    print "deleting job %s"%jobentity[0].replace("Sandbox-simulator_simula","Sandbox-simulator_simul").replace("Sandbox-simulator_simul","Sandbox-simulator_simulator")
                # except Exception,e:
                print e
            self.resourceMgr.removeJob(jobentity["job_name"])
            self.logger.info("cleaning up related data")
            os.system("rm -rf %s" % jobentity["related_data_path"])
            os.system("rm -rf /automation/jenkins/workspace/%s" % jobentity["related_data_path"])
开发者ID:bvbharatk,项目名称:cloudstack-automation,代码行数:24,代码来源:garbageCollector.py

示例4: JenkinsBot

# 需要导入模块: from jenkins import Jenkins [as 别名]
# 或者: from jenkins.Jenkins import delete_job [as 别名]

#.........这里部分代码省略.........

        self.connect_to_jenkins()

        try:
            if args[0] == 'pipeline':
                self.jenkins.create_job(
                    args[1],
                    JENKINS_JOB_TEMPLATE_PIPELINE.format(repository=args[2]))

            elif args[0] == 'multibranch':
                repository = args[2].rsplit('/', maxsplit=2)[-2:]

                self.jenkins.create_job(
                    args[1],
                    JENKINS_JOB_TEMPLATE_MULTIBRANCH.format(
                        repo_owner=repository[0].split(':')[-1],
                        repo_name=repository[1].strip('.git')))
        except JenkinsException as e:
            return 'Oops, {0}'.format(e)
        return 'Your job has been created: {0}/job/{1}'.format(
            self.config['URL'], args[1])

    @botcmd(split_args_with=None)
    def jenkins_deletejob(self, mess, args):
        """Delete a Jenkins Job.
        Example: !jenkins deletejob foo
        """
        if len(args) < 1:  # No job name
            return 'Oops, I need the name of the job you want me to delete.'

        self.connect_to_jenkins()

        try:
            self.jenkins.delete_job(args[0])
        except JenkinsException as e:
            return 'Oops, {0}'.format(e)

        return 'Your job has been deleted.'

    @botcmd(split_args_with=None)
    def jenkins_enablejob(self, mess, args):
        """Enable a Jenkins Job.
        Example: !jenkins enablejob foo
        """
        if len(args) < 1:  # No job name
            return 'Oops, I need the name of the job you want me to enable.'

        self.connect_to_jenkins()

        try:
            self.jenkins.enable_job(args[0])
        except JenkinsException as e:
            return 'Oops, {0}'.format(e)

        return 'Your job has been enabled.'

    @botcmd(split_args_with=None)
    def jenkins_disablejob(self, mess, args):
        """Disable a Jenkins Job.
        Example: !jenkins disablejob foo
        """
        if len(args) < 1:  # No job name
            return 'Oops, I need the name of the job you want me to disable.'

        self.connect_to_jenkins()
开发者ID:Djiit,项目名称:err-jenkins,代码行数:69,代码来源:jenkinsBot.py

示例5: execOnJenkins

# 需要导入模块: from jenkins import Jenkins [as 别名]
# 或者: from jenkins.Jenkins import delete_job [as 别名]
    def execOnJenkins(self, env, testSpecifierString, mailto, reRunFailedTests=True, retryCount=1, report=True, execOnOneZone=True,
           postOnPr=False, testMgr=None, avoidZones=None):
        try:
            env['hypervisor'] = ''
            if avoidZones is None:
               avoidZones=[]
            if testMgr is None:
               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 tests is not None:
                os.chdir(env['virtenvPath'])
                self.logger.info('launching jenkins TestExecutor Job')
                cscfg = configGenerator.getSetupConfig(env['config_file'])
                for zone in cscfg.zones:
                    if zone.name in avoidZones:
                       continue
                    for pod in zone.pods:
                        for cluster in pod.clusters:
                            for modifiedjob in jobModifier.addTests(env['build_number'], tests, self.throttle_job_count):
                                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.delete_job(modifiedjob)
                                    j.create_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'})
                                self.waitForJobComplete(env['virtenvPath'], [zone.name])
                                env['hypervisor'] = '%s,%s' % (env['hypervisor'], cluster.hypervisor.lower())

                            break

                        break

                    if execOnOneZone:
                        break

                tests = testMgr.getTests()

            j.delete_job(modifiedjob)

            reportAnalyserMap=self.getReportAnalysers(cscfg, env, execOnOneZone)  
            if(reRunFailedTests):
               while retryCount > 0:
                     self.logger.info("checking if we need to re run any of the tests")
                     testsToReRun=[]
                     for key in reportAnalyserMap.keys():
                         tests=reportAnalyserMap[key].suitsToRerun
                         if(tests is None):
                            avoidZones.append(key)
                         else:
                            testMgr.addTestsToReRun(tests) 
                     retryCount-=1
                     self.logger.info("zone name:%s The follwoing tests will be re run %s"%(key,tests))
                     if(len(testsToReRun)==0):
                       break
                     else: 
                        self.execOnJenkins(env, testSpecifierString, mailto, reRunFailedTests, retryCount, False, execOnOneZone, postOnPr, testMgr, avoidZones)
               
            if report and postOnPr:
                for key in reportAnalyserMap.keys():
                    self.reportOnPr(reportAnalyserMap[key].generateTextReport2(), env)
            elif report:
                self.reportUsingJenkinsEmailPlugin(cscfg, env)
            return env
        except Exception as e:
            self.logger.exception(e)
开发者ID:bvbharatk,项目名称:cloudstack-automation,代码行数:83,代码来源:testEnv.py

示例6: execOnJenkins

# 需要导入模块: from jenkins import Jenkins [as 别名]
# 或者: from jenkins.Jenkins import delete_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) 
开发者ID:swill,项目名称:cloudstack-automation,代码行数:77,代码来源:testEnv.py


注:本文中的jenkins.Jenkins.delete_job方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。