[Buildbot-devel] is there a way to set haltOnFailure at build time?

Alexander O'Donovan-Jones Alexander at ccpgames.com
Wed Oct 13 22:13:24 UTC 2010


look into doStepIf. It has access to the step it's associated with, and through that can query the build, even tunnel its way upto the master if need be.
You can also use it to query, modify, create or remove properties, basically encapsulating a 'traditional python' style function.

I use them to check for certain properties that might crop up like so:

def checkForPropertyFoo(step):
    if 'foo' in step.build.getProperties():
        value = step.build.getProperty('foo')
        if value not in (None, 'None', ''):
            return True
    return False

This just checks for the property foo, and does some simple validation on it. They're pretty cool things once you start (ab)using them.
________________________________________
From: Doug Latornell [djl at douglatornell.ca]
Sent: 13 October 2010 19:39
To: Buildbot Mailing List
Cc: robert dugal
Subject: Re: [Buildbot-devel] is there a way to set haltOnFailure at build      time?

I do something similar in my builders. In my case I want to skip
certain steps if a property has been set. I use a custom ShellCommand
with code like this in the start() method:

def start(self):
    ...
    if self.getProperty('make_refs'):
        return SKIPPED
    else:
        ShellCommand.start(self)

I think you should be able to set self.haltOnFailure as you wish in
the clauses of the if/else.

Doug

On Wed, Oct 13, 2010 at 9:39 AM, robert dugal <rmdugal at hotmail.com> wrote:
>
> Is it possible to set haltOnFailure to the result of some function, such as one that checks if a property exists?
> I have a builder that creates a package that is used by other builders. The builder has unit tests that are sometimes failing which causes the builder to not produce a build package.
> This prevents the other builders from working. There's nothing wrong with this design and it is the proper way things should work.
>
> However, there are sometimes special instances where I want the unit tests failures to be ignored and produce a package anyways, so I can run the other builders.
> I was hoping I could set haltOnFailure=False when some property like IGNORE_UNIT_TEST_FAILURES was defined in the force build web page.
> However it doesn't seem to work.
>
> Any suggestions on how to accomplish this?
>
> def TryThis(step):
>     """
>
>     """
>
>     result = True
>     properties = step.build.getProperties()
>     if properties.has_key('IGNORE_UNIT_TEST_FAILURES'):
>             result = False
>     return result
>
> class DummyFactory(BuildFactory):
>     def __init__(self,
>                 final_empty=False,
>                 **kwargs):
>         BuildFactory.__init__(self)
>         self.addStep(ShellCommand(name='T1', command="ls foobar/", haltOnFailure=TryThis, flunkOnFailure=TryThis ))
>         self.addStep(ShellCommand(name='T2', command="ls", haltOnFailure=True ))
>
>
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
> Spend less time writing and  rewriting code and more time creating great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
> _______________________________________________
> Buildbot-devel mailing list
> Buildbot-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/buildbot-devel
>

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Buildbot-devel mailing list
Buildbot-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/buildbot-devel





More information about the devel mailing list