是否有使用Mercurial的buildbot的任何工作示例

时间:2011-03-08 20:12:51

标签: mercurial buildbot

正在使用的buildbot版本是:

$ buildbot --version
Buildbot version: 0.8.3p1
Twisted version: 10.1.0

Checkconfig,给我错误:

$ buildbot checkconfig
/usr/lib/python2.6/dist-packages/twisted/mail/smtp.py:10: DeprecationWarning: the MimeWriter module is deprecated; use the email package instead
  import MimeWriter, tempfile, rfc822
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/buildbot-0.8.3p1-py2.6.egg/buildbot/scripts/runner.py", line 1071, in doCheckConfig
    ConfigLoader(configFileName=configFileName)
  File "/usr/local/lib/python2.6/dist-packages/buildbot-0.8.3p1-py2.6.egg/buildbot/scripts/checkconfig.py", line 46, in __init__
    self.loadConfig(configFile, check_synchronously_only=True)
  File "/usr/local/lib/python2.6/dist-packages/buildbot-0.8.3p1-py2.6.egg/buildbot/master.py", line 883, in loadConfig
    % (b['name'], n))
ValueError: builder runtests uses undefined slave example-slave
$ 

以下是我看过的一个例子:

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

2 个答案:

答案 0 :(得分:4)

这适用于:

Buildbot version: 0.8.8
Twisted version: 13.2.0

我有一些严重的问题让它使用一个简单的hg repo,而同一个项目与git和相应的函数一起正常工作。所以就是这样。

在master.cfg中有三个地方处理我们的repo:changesources,schedulers和builders,只有使用mercurial特定函数的changeources和builder。

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是'default'。 pollInterval=30每30秒说一次,检查一次新的提交(这是一个玩具示例,实际上> 30会更合适)。

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

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频道指出这一点。

答案 1 :(得分:2)

你看的例子很老了; <{1}}不久前被重命名为c['bots'],还有更多更改。

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

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

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

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

提供的一个示例是IcedTea buildbot,它是从Mercurial repos构建的。配置可以在这里浏览:

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

您也可以通过irc.freenode.net上的#buildbot寻求帮助。

相关问题