4

正在使用的 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:构建器运行测试使用未定义的从属示例-从属
$

这是我看过的一个例子:

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

4

2 回答 2

4

这涉及:

Buildbot version: 0.8.8
Twisted version: 13.2.0

我有一些严重的问题要让它与一个简单的 hg repo 一起工作,而同一个项目在 git 和适当的功能上工作得很好。所以就在这里。

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

更改源部分:

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 或其他内容。

branchmercurial 的默认设置是“默认” 。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...

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

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

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

于 2013-11-23T01:03:02.190 回答
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 来寻求帮助。

于 2011-03-08T20:19:51.153 回答