有没有使用 Mercurial 的 buildbot 的工作示例

发布于 2024-10-20 19:21:00 字数 1193 浏览 2 评论 0原文

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

buildbot version being used is:

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

Checkconfig, gives me errors:

$ 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
$ 

Here is one example i looked at :

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

束缚m 2024-10-27 19:21:00

这涉及到:

Buildbot version: 0.8.8
Twisted version: 13.2.0

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

master.cfg 中有三个地方处理我们的存储库:changesources、调度程序和构建器,其中只有使用 Mercurial 特定功能的 Changesources 和构建器。

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 上的默认分支是“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 频道的 tomprince 指出了这一点。

This pertains to:

Buildbot version: 0.8.8
Twisted version: 13.2.0

I had some serious issues to get it working with a simple hg repo, while the same project worked fine with git and the appropriate functions. So here it is.

There are three places deal with our repo in master.cfg: changesources, schedulers and builders, with only changesources and builders that use mercurial specific functions.

In changesources section:

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)

Here I use HgPoller, instead of PBChangeSource. The latter is more sophisticated but also requires more configuration steps (provide a port and yet another username and password).

repourl must point to the root of your hg repository. Any URL that could be used for "hg pull" or "hg clone" is acceptable. This example involves a local repository, but it could be on a server, then you would specify http something or else.

The default branch on mercurial is 'default'. pollInterval=30 says every 30 seconds, check for a new commit (this is from a toy example, in reality >30 would be more suitable).

Now the builder, which builds after a commit is detected and passed on by the scheduler(s):

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...

What explains why my thing did not work is that I did not specify defaultBranch and branchType. Those keywords are not the same as with Git(), so beware. This is a little tricky as I did not find them in the user manual online, but it's there if you take a moment within the python interpreter:

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

Also, note that this is the function Mercurial imported from buildbot.steps.source.mercurial, which is not the same Mercurial function that you would import imported from buildbot.steps.source.Mercurial. The latter is deprecated (or that which you would use on an older version). My thanks to tomprince from the IRC buildbot channel on freenode for pointing that out.

最美的太阳 2024-10-27 19:21:00

您看到的示例非常古老; 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 构建机器人,它是从 Mercurial 存储库构建的。配置可在此处浏览:

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

也欢迎您访问 irc.freenode.net 上的 #buildbot 寻求帮助。

The example you looked at is very old; c['bots'] was renamed to c['slaves'] a while ago, as well as many more changes.

I'd suggest taking a look at the Buildbot manual for configuration:

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

And possibly also the installation section, to make sure you did what was required to set up the more recent versions of BuildBot, not just older versions:

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

One example that was offered was the IcedTea buildbot, which builds from Mercurial repos. Configuration is browsable here:

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

You're also welcome to drop by #buildbot on irc.freenode.net for help.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文