【问题标题】:Is there any working example of buildbot with Mercurial是否有任何使用 Mercurial 的 buildbot 的工作示例
【发布时间】:2011-03-08 20:12:50
【问题描述】:

正在使用的buildbot版本是:

$ buildbot --version Buildbot 版本:0.8.3p1 扭曲版本:10.1.0

Checkconfig,给我错误:

$ buildbot checkconfig /usr/lib/python2.6/dist-packages/twisted/mail/smtp.py:10:弃用警告:MimeWriter 模块已弃用;改用电子邮件包 导入 MimeWriter、临时文件、rfc822 回溯(最近一次通话最后): doCheckConfig 中的文件“/usr/local/lib/python2.6/dist-packages/buildbot-0.8.3p1-py2.6.egg/buildbot/scripts/runner.py”,第 1071 行 ConfigLoader(configFileName=configFileName) 文件“/usr/local/lib/python2.6/dist-packages/buildbot-0.8.3p1-py2.6.egg/buildbot/scripts/checkconfig.py”,第 46 行,在 __init__ self.loadConfig(configFile, check_synchronously_only=True) loadConfig 中的文件“/usr/local/lib/python2.6/dist-packages/buildbot-0.8.3p1-py2.6.egg/buildbot/master.py”,第 883 行 % (b['name'], n)) ValueError: builder runtests uses undefined slave example-slave $

这是我看过的一个例子:

http://agiletesting.blogspot.com/2006/02/continuous-integration-with-buildbot.html

【问题讨论】:

    标签: mercurial buildbot


    【解决方案1】:

    这涉及到:

    Buildbot version: 0.8.8
    Twisted version: 13.2.0
    

    我在使用简单的 hg repo 时遇到了一些严重的问题,而同一个项目在 git 和适当的功能上运行良好。就是这样。

    master.cfg 中有三个地方处理我们的 repo:changesources、scheduler 和 builders,只有使用 mercurial 特定功能的 changesources 和 builders。

    changesources 部分:

    from buildbot.changes.hgpoller import HgPoller
    therepo=HgPoller(repourl="/home/user/test/my_project/",
                               branch='default',
                               pollInterval=30,
                               workdir='myrepo')
    
    c['change_source'] = []
    c['change_source'].append(therepo)
    

    这里我使用HgPoller,而不是PBChangeSource。后者更复杂,但也需要更多配置步骤(提供端口以及另一个用户名和密码)。

    repourl 必须指向您的 hg 存储库的根目录。任何可用于“hg pull”或“hg clone”的 URL 都是可以接受的。此示例涉及本地存储库,但它可能位于服务器上,然后您可以指定 http 或其他内容。

    mercurial 上的默认 branch 是“默认”。 pollInterval=30 说每 30 秒检查一次新提交(这是来自一个玩具示例,实际上 >30 会更合适)。

    现在是 builder,它在调度程序检测到并传递提交后构建:

    from buildbot.process.factory import BuildFactory
    from buildbot.steps.source.mercurial import Mercurial
    
    factory = BuildFactory()
    
    #watch out: this function is Mercurial, NOT Hg
    
    checkout_default = Mercurial(repourl="/home/user/test/my_project/",
                          defaultBranch='default',
                          branchType='inrepo',
                          haltOnFailure = True)
    
    factory.addStep(checkout_default)
    
    # then you add some build instructions and don't forget to import the necessary...
    

    解释为什么我的事情不起作用的原因是我没有指定defaultBranchbranchType。这些关键字与 Git() 不同,所以要小心。这有点棘手,因为我没有在在线用户手册中找到它们,但如果你花一点时间在 python 解释器中,它就在那里:

    import buildbot
    help(buildbot.steps.source.mercurial)
    

    另外,请注意,这是从 buildbot.steps.source.mercurial 导入的 Mercurial 函数,它与从 buildbot.steps.source.Mercurial 导入的 Mercurial 函数不同。后者已弃用(或您将在旧版本上使用的)。感谢 freenode 上 IRC buildbot 频道的 tomprince 指出这一点。

    【讨论】:

      【解决方案2】:

      你看到的例子很老了; c['bots'] 不久前重命名为 c['slaves'],还有更多变化。

      我建议查看 Buildbot 手册进行配置:

      http://buildbot.net/buildbot/docs/current/Configuration.html#Configuration

      可能还有安装部分,以确保您完成了设置最新版本的 BuildBot 所需的操作,而不仅仅是旧版本:

      http://buildbot.net/buildbot/docs/current/Installation.html#Installation

      提供的一个示例是 IcedTea buildbot,它是从 Mercurial 存储库构建的。可在此处浏览配置:

      http://icedtea.classpath.org/hg/buildbot/file

      也欢迎您通过 irc.freenode.net 上的#buildbot 来寻求帮助。

      【讨论】:

      • 非常感谢您的帮助。我认为它的配置仍然是问题,我不确定如何为 Mercurial 设置它。 icetea 示例给了我一些提示,但就我而言,代码库是 Python。当我尝试启动 buildbot 时,出现错误:
      • @kamal - 如果您需要更详细的帮助,我强烈建议您通过 IRC,因为它需要专门针对您的配置进行定制,因此与 SO 答案不太相关。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-03-29
      • 2014-11-07
      • 2014-05-26
      • 1970-01-01
      • 1970-01-01
      • 2019-11-22
      • 1970-01-01
      相关资源
      最近更新 更多