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


Python Jenkins.get_plugins方法代码示例

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


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

示例1: configure

# 需要导入模块: from jenkins import Jenkins [as 别名]
# 或者: from jenkins.Jenkins import get_plugins [as 别名]
 def configure(self):
     #self.logger.info("setting jenkins authentication method to use unix userdata")
     #self.checkForSuccess(bash("cp %s/jenkis_auth_file /var/lib/jenkins"%currentDir))
     #self.logger.info("setting jenkins password")
     #self.logger.info("echo %s | sudo passwd jenkins --stdin"%self.jenkinsPasswd)
     #self.checkForSuccess(bash("service jenkins restart"))
     time.sleep(10)
     self.logger.info("checking if auth config is successful")
     j=Jenkins(self.jenkinsUrl, "admin", self.jenkinsPasswd)
     try:
        j.get_plugins()
     except Exception as e:
        self.logger.info("failed to retrive plugin info, may be auth problem")
        self.logger.exception(e) 
        raise e
     self.logger.info("auth config successful")
     self.logger.info("installing requried plugins")
     self.logger.info("reading from jenkins plugins file %s/jenkins_plugins.txt"%currentDir)
     f=open('%s/jenkins_plugins.txt'%currentDir, 'r')
     pluginsToInstall=f.read()  
     pluginsToInstall=pluginsToInstall.split('\n')
     self.installPlugins(j,pluginsToInstall)
     self.logger.info("Plugin installation complete")
     self.logger.info("restarting jenkins")
     self.restartJenkins()
     self.logger.info("Creating CI jobs on jenkins")
     for file in os.listdir(os.path.join(currentDir,'jenkins_job_templates')):
       try:
          if not j.job_exists(file):
             f=open(os.path.join(currentDir,'jenkins_job_templates',file),'r')
             config=f.read()
             f.close()
             self.logger.info("creating job %s, reading config from file %s"%(repr(file),os.path.join(currentDir,'jenkins_job_templates',file)))
             j.create_job(file, config)  
          else:
            self.logger.info("job %s already exists, not creating"%file)
       except Exception as e:
            self.logger.warn("failed to create job %s"%(file))
            self.logger.exception(e) 
     self.logger.info("created all CI jobs")
     self.logger.info("Adding driverVM as node in jenkins")
     params = {
              'port': '22',
              'username': 'jenkins',
              'credentialsId':'abe3f139-77bd-4db4-824b-1c79d5205d8b',
              'host':self.config['nodes']['driverVM']['ip'] 
     }
     self.addPasswdToCredential(j,"vagrant")
     self.checkForSuccess(bash("cp %s /var/lib/jenkins/."%(os.path.join(currentDir,"jenkins_credentials","credentials.xml"))))
     j.create_node('driverVM', numExecutors=20, nodeDescription="CI slave VM", remoteFS='/automation/jenkins', labels='driverVM', exclusive=True,launcher=jenkins.LAUNCHER_SSH, launcher_params=params) 
     self.logger.info("jenkins install complete")
开发者ID:bvbharatk,项目名称:CI-orchestrator,代码行数:53,代码来源:configure_jenkins.py

示例2: restartJenkins

# 需要导入模块: from jenkins import Jenkins [as 别名]
# 或者: from jenkins.Jenkins import get_plugins [as 别名]
 def restartJenkins(self):
     self.checkForSuccess(bash("service jenkins restart"))
     retry=20
     while retry > 0:
       retry-=1
       try:
           j=Jenkins(self.jenkinsUrl, "admin", self.jenkinsPasswd)
           j.get_plugins()
           break
       except Exception as e:
            if retry==0:
               self.logger.info("Failed to restart jenkins")  
            else:
               time.sleep(20)
               self.logger.info("waiting for jenkins to restart, this may take a while")
开发者ID:bvbharatk,项目名称:CI-orchestrator,代码行数:17,代码来源:configure_jenkins.py

示例3: installPlugins

# 需要导入模块: from jenkins import Jenkins [as 别名]
# 或者: from jenkins.Jenkins import get_plugins [as 别名]
 def installPlugins(self, Jenkins, pluginsToInstall):
     plugins=Jenkins.get_plugins()
     currentPluginList=[]
     for k,v in plugins.keys():
         currentPluginList.append(k)
     installedPluginList=[]
     installedPluginList.append("startVal")
     while len(installedPluginList) > 0:      
          installedPluginList=[]
          for plugin in pluginsToInstall:
              if(len(plugin)==0):
                pass
              else:
                print "trying to install plugin %s"%plugin
                Jenkins.install_plugin(plugin,True)
          time.sleep(60)
          self.restartJenkins()
          plugins=Jenkins.get_plugins()
          for k,v in plugins.keys():
              if k not in currentPluginList:
                 installedPluginList.append(k)
                 currentPluginList.append(k)
          print "set diff", installedPluginList    
开发者ID:bvbharatk,项目名称:CI-orchestrator,代码行数:25,代码来源:configure_jenkins.py

示例4: get_plugins_dict

# 需要导入模块: from jenkins import Jenkins [as 别名]
# 或者: from jenkins.Jenkins import get_plugins [as 别名]
def get_plugins_dict(jenkins_url, puppet=False, user=None, password=None):
    if user is not None:
        logger.debug("Connecting to Jenkins (<%s>) as user %s ...",
                     jenkins_url, user)
        j = Jenkins(jenkins_url, user, password)
    else:
        logger.debug("Connecting to Jenkins (<%s>) anonymously...", jenkins_url)
        j = Jenkins(jenkins_url)
    logger.debug("Connected.")
    p = j.get_plugins()
    plugins = {}
    for k, v in p.items():
        plugins[k[0]] = v['version']
    return plugins
开发者ID:jantman,项目名称:misc-scripts,代码行数:16,代码来源:jenkins_list_plugins.py

示例5: main

# 需要导入模块: from jenkins import Jenkins [as 别名]
# 或者: from jenkins.Jenkins import get_plugins [as 别名]
def main(jenkins_url, user=None, password=None):
    if user is not None:
        logger.debug("Connecting to Jenkins as user %s ...", user)
        j = Jenkins(jenkins_url, user, password)
    else:
        logger.debug("Connecting to Jenkins anonymously...")
        j = Jenkins(jenkins_url)
    logger.debug("Connected.")
    p = j.get_plugins()
    plugins = {}
    namelen = 0
    for k, v in p.items():
        plugins[k[0]] = v['version']
        if len(k[0]) > namelen:
            namelen = len(k[0])
    # format
    for name, ver in sorted(plugins.items()):
        print("  jenkins::plugin {'%s': version => '%s'}" % (name, ver))
开发者ID:nilkonto,项目名称:misc-scripts,代码行数:20,代码来源:jenkins_plugins_to_puppet.py

示例6: Jenkins

# 需要导入模块: from jenkins import Jenkins [as 别名]
# 或者: from jenkins.Jenkins import get_plugins [as 别名]
#!/usr/bin/env python

from jenkins import Jenkins
import sys

server = Jenkins(sys.argv[1])
for plugin in server.get_plugins().itervalues():
  print ("{name}:{version}".format(name=plugin['shortName'],
                                   version=plugin['version']))
开发者ID:naumvd95,项目名称:jenkins-jobs-lab,代码行数:11,代码来源:get_plugins.py


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