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

标签 mercurial buildbot

正在使用的 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

最佳答案

这涉及:

Buildbot version: 0.8.8
Twisted version: 13.2.0

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

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

更改资源 部分:
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 或其他内容。

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

现在 build 者 ,它在调度程序检测到并传递提交之后构建:
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 channel 的 tomprince 指出这一点。

关于mercurial - 是否有任何使用 Mercurial 的 buildbot 的工作示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5237772/

相关文章:

git - Mercurial 中的分支是否和 Git 一样好用?

mercurial - 如何将N个本地最高提交转换为MQ补丁?

git - 如何使用 buildbot 设置 git 提交后 Hook

visual-studio-2008 - 如何在 Visual Studio Publish 上自动标记 Mercurial?

mercurial - hg unshelve 好像没有效果?

python - 使用单个 buildslave 为多个 buildmaster 提供服务

python - 我如何任意告诉 Buildbot 不要为给定的更改安排构建?

python - 无法重启 buildbot master

mercurial - 在错误的文件拆分后断开 Mercurial 中的文件连接

testing - buildbot 没有将 mercurial 更新到 forcebuilds 的最新负责人