[Buildbot-devel] Persistent Properties

Jared Grubb jared.grubb at gmail.com
Wed Jun 10 05:19:06 UTC 2015


This is what I do to get a mini-history around a build for email .. note that it does get builds later becuase builds can finish earlier than later builds...


    def get_recent_builds(self, master_status, build, before=3, after=3):
        builder = build.getBuilder()

        build_number = build.getNumber()

        any_prior_bad = False
        any_later_good = False

        builds = []
        for number in range(build_number-before, build_number+after+1):
            b = builder.getBuild(number)
            if b is None:
                continue

            if b.isFinished():
                result = b.getResults()
                result = self.getBuildResultString(result)

                if number < build_number and result in ['failure', 'warning']:
                    any_prior_bad = True
                if number > build_number and result in ['success']:
                    any_later_good = True

            elif b.getCurrentStep():
                result = "building"
            else:
                result = "pending"

            builds.append({
                'build': b,
                'number': number,
                'result': result,
                'url': master_status.getURLForThing(b),
            }) 

        return builds

    def getBuildResultString(self, result):
        if isinstance(result, int):
            return Results[result]
        return 'none'

> On Jun 9, 2015, at 09:13, Mikhail Sobolev <mss at mawhrin.net> wrote:
> 
> Hi Jared,
> 
> On Mon, Jun 08, 2015 at 07:54:33PM -0700, Jared Grubb wrote:
>>   This is for the web or for email purposes?
>>   I have some code I can share for email if that’s your application.
> Please do :)  Maybe we could put into upstream codebase :)
> 
> -- 
> Misha
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Buildbot-devel mailing list
> Buildbot-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/buildbot-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://buildbot.net/pipermail/devel/attachments/20150609/685c555c/attachment.html>


More information about the devel mailing list