如何从 Buildbot 捕获内部版本号

发布于 2024-12-09 08:00:39 字数 41 浏览 3 评论 0原文

master.cfg 中有我可以访问的变量吗?文档根本不清楚。谢谢。

Is there a variable that I can access in master.cfg? The docs aren't clear at all. Thanks.

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

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

发布评论

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

评论(1

半山落雨半山空 2024-12-16 08:00:39

获取此信息的方法有多种,但这取决于您尝试访问它的位置。

如果您位于 doStepIf 过程中(作为 addStep 的参数),这应该有效:

def insideDoStepIf(step):
    step.build.getStatus().number

如果您尝试按构建器的下一个版本号确定构建器的优先级,这应该有效:

def buildPriority(buildmaster, builders):
    builders.sort(key=lambda b: b.builder_status.nextBuildNumber)
    return builders

c['prioritizeBuilders'] = buildPriority

如果您有兴趣在 buildbot.status.mail.MailNotifiermessageFormatter 函数中获取此信息,请尝试以下操作:

def formatEmail(mode, name, build, results, master_status):
    for builder in master_status.getBuilderNames():
        master_status.getBuilder(builder).nextBuildNumber

我没有测试 这些,我不能保证这里的 api 是稳定的,但我非常有信心这些应该可以工作,因为我在我自己的 master.cfg 中做了一些类似的事情(尽管不是内部版本号)

There are ways of getting this information, but it depends on where you are trying to access it.

If you are inside a doStepIf procedure (as a parameter to addStep), this should work:

def insideDoStepIf(step):
    step.build.getStatus().number

If you are trying to prioritize your builders by their next build number, this should work:

def buildPriority(buildmaster, builders):
    builders.sort(key=lambda b: b.builder_status.nextBuildNumber)
    return builders

c['prioritizeBuilders'] = buildPriority

If you are interested in getting this information in a messageFormatter function for a buildbot.status.mail.MailNotifier, try this:

def formatEmail(mode, name, build, results, master_status):
    for builder in master_status.getBuilderNames():
        master_status.getBuilder(builder).nextBuildNumber

I did not test these, and I can't guarantee that the api here is stable, but I'm pretty confident that these should work, as I'm doing a few similar things (though, not with build number) in my own master.cfg

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