简体   繁体   中英

How to capture the build number from the Buildbot

Is there a variable that I can access in master.cfg ? The docs aren't clear 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM