开发者

How to capture the build number from the Buildbot

Is there a variable that I can access in master.cfg? The docs aren't cl开发者_如何学Goear at all. Thanks.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜