1

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

Marcus Adams
  • 53,009
  • 9
  • 91
  • 143
Riziero
  • 144
  • 2
  • 14
  • 1
    Has my answer been helpful to you, or is it still lacking something? I'm happy to improve it if it's not what you're looking for. – Nate Oct 19 '11 at 18:22

1 Answers1

6

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

Nate
  • 12,499
  • 5
  • 45
  • 60
  • Heyy Nate ! I'm executing a shell script to start a build and I need to capture build number of a failed build from buildbot and I have multiple builder in master. please tell me how can I do that ? I did not find this "doStepIf" method you mentioned in the answer. – Cereal_Killer Feb 04 '14 at 05:45